Skip to content

Tony9984/java-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Code Practice

Repository to practice Java code Heavily inspired by https://github.com/jwasham/coding-interview-university

Arrays

https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html

  • Implement an Array List with the following methods:
    • isEmpty() - return true if the list is empty
    • size() - return the number of elements in the list
    • capacity() - return the capacity of the list
    • add(element) - add an element to the end of the list
    • remove(index) - remove an element at the given index
    • get(index) - return the element at the given index
    • set(element, index) - replace an element at the given index

Linked Lists

https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html

  • Implement a Doubly Linked List with the following methods:
    • isEmpty() - return true if the list is empty
    • size() - return the number of elements in the list
    • add(element, index) - add an element at the specified index
    • addFirst(element) - add an element at the beginning of the list
    • addLast(element) - add an element at the end of the list
    • remove(index) - remove an element at the specified index
    • removeFirst() - remove the first element in the list
    • removeLast() - remove the last element in the list
    • getFirst() - return the first element in the list
    • getLast() - return the last element in the list
    • get(index) - return the element at the given index
    • set(element, index) - replace an element at the given index

Data Structures practice problems

Taken from UC San Diego Coursera course

  • Check brackets in code [Stack]
  • Extending stack interface [Stack]
  • Network packet processing [Queue]
  • Maximum sliding window [Stack/Queue]
  • Compute tree height [Tree]

About

Java coding exercises

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages