This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Exercises | |
| 1. What is a binary tree and what makes it unique to other trees? | |
| A binary tree is a data structure consisting of nodes that contain a ‘left’ and a ‘right’ reference. A binary tree is unique because every Node can only have up to two child Nodes. | |
| 2. What is a heuristic? | |
| Heuristic are ‘best’ guesses used to solve complex problems quickly. Accuracy can be sacrificed for speed. | |
| 3. What is another problem besides the shortest-path problem that requires the use of heuristics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Exercises | |
| 1. What is a hash table? | |
| A hash table is a data structure that stores each value by connecting it to a key, forming key-value pairs. | |
| 2. What is hashing? | |
| Hashing is the process of converting data into a hash code using a hashing function. | |
| 3. How does a hash table store data | |
| A hash table store data by converting the key into a hash code and storing it in an array index. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Exercises | |
| 1. What is a hash table? | |
| A hash table is a data structure that stores each value by connecting it to a key, forming key-value pairs. | |
| 2. What is hashing? | |
| Hashing is the process of converting data into a hash code using a hashing function. | |
| 3. How does a hash table store data | |
| A hash table store data by converting the key into a hash code and storing it in an array index. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### EXERCISES | |
| 1. What are some pros and cons of using linked lists instead of arrays? | |
| Pros: | |
| ✓Linked lists do not contain empty placeholders as nodes are created dynamically | |
| ✓Due to the fact that nodes are independent in memory, the operating system can use any available memory what allows for linked lists to be huge in size. | |
| Cons: | |
| .Inefficient way to access elements within the list. Elements must be accessed in order , starting from the head or first node. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Exercises#### | |
| 1) What is the main difference between a stack and a queue? | |
| Stack is a data structure that arranges elements in LIFO(last-in-first-out) order, and uses “push” to insert and “pop” to remove an element. | |
| Queue is a data structure that arranges elements in FIFO(first-in-first-out) order, and uses “enqueue” to insert data and “dequeue” to remove data. | |
| 2) What are the similarities between stacks and queues? | |
| Both are data structures in which elements are store and retrieved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### EXERCISES | |
| 1. Given the above real-world information, use an array data structure to code the following solution. | |
| a) Use an array input: ["Vivian", "Ava", "Josh", "Patrick", "Mike"] | |
| var namesArr = ["Vivian", "Ava", "Josh", "Patrick", "Mike"] | |
| b) Insert a new person, "Mary" at the end of the line. In other words, you should insert Mary after Mike. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### SHORT ANSWER | |
| 1) Why do programmers use pseudocode? | |
| Programmers use pseudocode to help them develop an algorithm and how to end product should look like. Pseudocode helps programmers to structure and explore the logic of the program in a more human friendly manner | |
| 2) If you run pseudocode on your computer what would happen? |
NewerOlder