-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
55 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
build | ||
build | ||
.DS_Store |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Arrays and strings | ||
# Arrays and strings |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
# Stacks and Queues | ||
|
||
1. A stack uses LIFO (last-in first-out) ordering. It uses the following operations: | ||
- pop(): Remove the top item from the stack. | ||
- push(item): Add an item to the top of the stack. | ||
- peek(): Return the top of the stack. | ||
- isEmpty(): Return true if and only if the stack is empty. | ||
|
||
2. Unlike an array, a stack does not offer constant-time access to the ith item. However, it does allow constant- | ||
time adds and removes. | ||
|
||
3. One case where stacks are often useful is in certain recursive algorithms. A stack can also be used to implement a recursive algorithm iteratively. | ||
|
||
- pop(): Remove the top item from the stack. | ||
- push(item): Add an item to the top of the stack. | ||
- peek(): Return the top of the stack. | ||
- isEmpty(): Return true if and only if the stack is empty. | ||
2. Unlike an array, a stack does not offer constant-time access to the ith item. However, it does | ||
allow constant-time adds and removes. | ||
3. One case where stacks are often useful is in certain recursive algorithms. A stack can also be used | ||
to implement a recursive algorithm iteratively. | ||
4. A queue implements FIFO (first-in first-out) ordering. It uses the following operations: | ||
- add(item): Add an item to the end of the list. | ||
- remove(): Remove the first item in the list. | ||
- peek(): Return the top of the queue. | ||
- isEmpty(): Return true if and only ifthe queue is empty. | ||
|
||
- add(item): Add an item to the end of the list. | ||
- remove(): Remove the first item in the list. | ||
- peek(): Return the top of the queue. | ||
- isEmpty(): Return true if and only if the queue is empty. | ||
5. One place where queues are often used is in breadth-first search or in implementing a cache. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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