A study on data structure and algorithms by prbn.
Algorithms and Data structures are the tools for a programmer to create a system.
First, you learn about Big O notations.
With this you can make good decisions about how to code, because it allows you to evaluate the efficiency of your code's algorithms, based on computational complexity.
algorithms and data structures are the tools for a programmer to create a system.
- data structures are used to organize information.
- algorithms are the instructions for processing this information.
A system can be made in "n" ways, one of them is Object Oriented Programming, using:
- classes / objects
- methods / inheritance
with P.O.O. we can...
- Make data structures like Stack and Linked List became classes.
- Make Algorithms methods of these classes.
- Make simpler or more widely used data structures and algorithms be used through inheritance.
// Building a linked list to exemplify
class Node {
constructor(value) {...}
}
class LinkedList {
// algorithms
constructor(value) {...}
push(value) {...}
unshift(value) {...}
insert(index, value) {...}
remove(index) {...}
pop() {...}
shift() {...}
}
// some of the things we can do by building linked list class.
let myLinkedList = new LinkedList(25)
myLinkedList.push(9)
myLinkedList.unshift(3)
myLinkedList.insert(1, 15)
myLinkedList.remove(1)
myLinkedList.pop()
myLinkedList.shift()