Fichas
Introduction to Data Structures
Fichas del conjunto (11)
- 1Stack1. Linear data structure
2. Data is added or pushed onto the top of the stack
3. Data is removed or popped from the top of the stack
4. Stack is a LIFO last in first out data structure - 2Queue1. Linear data structure
2. Data is added to the tail of the queue
3. Data is removed from the head of the queue
4. Queue is a FIFO first in in first out data structure - 3ImplementationStatic (array - define the amount of storage needed when you write the program)
Dynamic (linked list - data is allocated when required during running time) - 4How do you make array storing queue more efficient?Use a circular array
- 5Give 2 advantages and 2 disadvantages of arrays vs linked list as candidates for holding a data structureArrays - fixed length, you use specific space allocated, cannot add in the middle
Linked list - dynamic, can always extend/shorten, can add whenever in between - 6What distinguishes a recursive method from a non-recursive method?Recursive method will call itself
- 7What does it mean by programming term recursively and give one + and one - of itRecursion is a programming technique where a method includes a call to itself /
- 8Define a balanced binary tree and explain why would you use this over a non-balancedA tree is balanced if for every node the difference in depth of its two subtrees is at most one. Better search time
- 9What is the significance of using keys in binary trees?The nodes are implemented and sorted using a specific key, it allows us to search for a specific node, we can only have one node with such key, we can print in the order of keys
- 10What is the difference between solving a problem using iteration vs recursion?loop (quicker, harder to implement) vs recursion (easier to implement)
Recursion is better than iteration for problems that can be broken down into multiple, smaller pieces. - 11Stack using arrayFull when top == maxSize-1
Empty when top == -1
Información
- Descripción
- Computer Science Fichas sobre Introduction to Data Structures, creado por Neja Cesnik el 13/05/2018.
- Creado por
- Neja Cesnik · may 2018
- Actualizado
- 13 may 2018
- Visitas
- 0
- Valoración