Skip to content

BrandynVay/data-structures-and-algorithms

Repository files navigation

Table of Contents

Code Challenges

  1. Code Challenge 06
  1. Code Challenge 07
  1. Code Challenge 08
  1. Code Challenge 11
  1. Code Challenge 12
  1. Code Challenge 13
  1. Code Challenge 16
  1. Code Challenge 17
  1. Code Challenge 18
  1. Code Challenge 31
  1. Code Challenge 32
  1. Code Challenge 33

DSA Implementation

  1. Trees
  1. Hash Table

Code Challenges

Code Challenge 06

Authors: Joseph Hangarter & Brandyn Vay

Challenge

  • .append(value) which adds a new node with the given value to the end of the list
  • .insertBefore(value, newVal) which add a new node with the given newValue immediately before the first value node
  • .insertAfter(value, newVal) which add a new node with the given newValue immediately after the first value node

Approach & Efficiency

Solution

Code Challenge 6

back to the top


Code Challenge 07

Authors: Joseph Hangarter & Brandyn Vay

Challenge

  • k-th value from the end of a linked list.

Approach & Efficiency

Solution

Code Challenge 7

back to the top


Code Challenge 08

Authors: Brad Smialek & Brandyn Vay

Challenge

  • merge two linked list into one.

Approach & Efficiency

Solution

Code Challenge 8

back to the top


Code Challenge 11

Authors: Brandyn Vay, Jonny Graybill, and Jeremy Lee

Challenge

  • take two stacks and use queue implementation

Approach & Efficiency

Solution

Code Challenge 11

back to the top


Code Challenge 12

Authors: Brandyn Vay, Brad Smialek

Challenge

  • Create a class called AnimalShelter which holds only dogs and cats. The shelter operates using a first-in, first-out approach.

Approach & Efficiency

Solution

Code Challenge 12

back to the topv


Code Challenge 13

Authors: Brandyn Vay, Brad Smialek

Challenge

  • Your function should take a string as its only argument, and should return a boolean representing whether or not the brackets in the string are balanced.

Approach & Efficiency

Solution

Code Challenge 13

back to the top


Code Challenge 16

Authors: Brandyn Vay, Brad Smialek

Challenge

  • Conduct “FizzBuzz” on a tree while traversing through it. Change the values of each of the nodes dependent on the current node’s value.

Approach & Efficiency

Solution

Code Challenge 16

back to the top


Code Challenge 17

Authors: Brandyn Vay, Adrienne Easton

Challenge

  • Write a breadth first traversal method which takes a Binary Tree as its unique input. Without utilizing any of the built-in methods available to your language, traverse the input tree using a Breadth-first approach; print every visited node’s value.

Approach & Efficiency

Solution

Code Challenge 17

back to the top


Code Challenge 18

Authors: Brandyn Vay, Adrienne Easton

Challenge

  • Write a function called find-maximum-value which takes binary tree as its only input. Without utilizing any of the built-in methods available to your language, return the maximum value stored in the tree. You can assume that the values stored in the Binary Tree will be numeric.

Approach & Efficiency

Solution

Code Challenge 18

back to the top


Code Challenge 31

Authors: Brandyn Vay

Challenge

  • Write a function that accepts a lengthy string parameter.

Approach & Efficiency

Solution

Code Challenge 31

back to the top


Code Challenge 32

Authors: Brandyn Vay

Challenge

  • Write a function called tree_intersection that takes two binary tree parameters.

Approach & Efficiency

Solution

Code Challenge 32

back to the top


Code Challenge 33

Authors: Brandyn Vay

Challenge

  • Write a function that LEFT JOINs two hashmaps into a single data structure.
  • The first parameter is a hashmap that has word strings as keys, and a synonym of the key as values.
  • The second parameter is a hashmap that has word strings as keys, and antonyms of the key as values.
  • Combine the key and corresponding values (if they exist) into a new data structure according to LEFT JOIN logic.
  • LEFT JOIN means all the values in the first hashmap are returned, and if values exist in the “right” hashmap, they are appended to the result row. If no values exist in the right hashmap, then some flavor of NULL should be appended to the result row.
  • The returned data structure that holds the results is up to you. It doesn’t need to exactly match the output below, so long as it achieves the LEFT JOIN logic.

Approach & Efficiency

Solution

Code Challenge 33

back to the top


DSA Implamentation

Trees

Challenge

create a binary tree and a binary search tree

Approach & Efficiency

API

  1. Binary Tree
  • preOrder()
  • postOrder()
  • inOrder()
  1. Binary Search Tree
  • add
  • contains

back to the top


Hash Tables

Challenge

Implement a Hashtable with the following methods:

  • add: takes in both the key and value. This method should hash the key, and add the key and value pair to the table, handling collisions as needed.
  • get: takes in the key and returns the value from the table.
  • contains: takes in the key and returns a boolean, indicating if the key exists in the table already.
  • hash: takes in an arbitrary key and returns an index in the collection.

Approach & Efficiency

O(1)

API

  1. Hash Table
  • add()
  • get()
  • contains()
  • hash()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published