pointer array parameter passing

Create a new Array on the Heap Creating a new array on the heap basically means: 1) we create a row of new objects that are next to each other 2) We then have an index pointer pointing to it. A index pointer is a pointer pointing to the FIRST element of the array. That […]

Binary Array Search

Pre print recursion

ref – http://shanghaiseagull.com/index.php/2015/11/16/simple-recursion/

note: recFunc is a placeholder name for any recursive function name that you are running. a) we write the push of the function for recFunc( 3 ) onto the main stack b) We begin for the start of line for recFunc( 3 ) at comment #1 c) We check the base […]

Recursion Concepts

ref – https://www.cs.drexel.edu/~mcs172/Su04/lectures/07.3_recursion_intro/Dangers.html?CurrentSlide=7 https://en.wikipedia.org/wiki/Recursion_termination Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem. In other words, when a function calls itself from its body. The power of recursion lies in the possibility of defining an infinite set of objects by a […]

List Insertion Sort

download source A note on passing Arrays to functions Given an array of Node pointers…..each element is a pointer to a Node object. 1) We get a random int

2) Create a Node object 3) assign the random into to the Node object

4) then point the array element to the Node object […]

Sorted Linked List

download source The key to understanding sorted insertion is to have 2 pointers. One is current, the other is trailer. While the current is not NULL, and the incoming data to be inserted is larger than the current’s data, then we move forward We move forward by having the trailer and current move forward. Trailer […]

Queue Linked List

download source Queue is First In First Out, FIFO. This means that Nodes are processed in order. They get in line, and each node is taken care of in the order added (or received). In order to do this, we have a first and a last pointer. The first pointer points to the beginning of […]

Stack Linked List

source download Stacked list is all about having ONE head pointer. Pop is O(1) Push is O(1) The head pointer is used to add and remove. For append: 1) We have head point to NULL in the beginning 2) First item is initialized through being supplied with values from its constructor parameters. These parameters are […]

Simple Linked List

source code A simple linked list in C++ Basic features Running time Features – add by appending – search – remove – display A linked list is a bunch of nodes ‘linked’ together by pointers. Each node has a ‘next’ pointer that points tot he next node. This is what creates the link. First step […]

Stacks and Queues

In an array, any item can be accessed, either immediately through its index, or by searching through the sequence of cells until its found. In stacks and queues, however, access is restricted. Only one item can be read or removed at a given time. Their interface is designed to enforce this restricted access. Theoretically, access […]