Giter VIP home page Giter VIP logo

dsa-golang's Introduction

dsa-golang

Data Structures and Algorithms in Go

Content

  1. ArrayList

  2. LinkedList

  • Singly LinkedList

  • Doubly LinkedList

  • Circular LinkedList

  1. Stack
  • NodeStack implementation

  • ArrayStack implementation

  1. Queue
  • Node Queue implementation

  • Deque - Double ended queue

  1. Binary Heap

  2. Sorting algorithms

  • BubleSort

  • MergeSort

  • QuickSort

go run .
go test ./...

Array List

Method Complexity
get(i) O(1)
set(i,e) O(1)
add(i,e) O(n)
remove(i) O(n)
size() O(1)
isEmpty() O(1)

Linked List

Singly Linked List is a list of nodes where each node contains some data and a reference to the next node in the sequence.

Method Complexity
AddFirst(value) O(1)
AddLast(value) O(n)
Add(index,value) O(n)
RemoveFirst() : int O(1)
RemoveLast() : int O(n)
Remove(index) : int O(n)
GetFirst() : int O(1)
GetLast() : int O(n)
Get(index) : int O(n)
PrintList() O(n)
Length() : int O(1)
IsEmpty() : bool O(1)

Stack

Stack use LIFO (last-in first-out) ordering.

Method Complexity
Push(value) O(1)
Peek() int O(1)
Pop() int O(1)
Size() : int O(1)
IsEmpty() : bool O(1)

Queue

Queue use FIFO (first-in first-out) ordering.

Method Complexity
Add(value) O(1)
Peek() int O(1)
Remove() int O(1)
Size() : int O(1)
IsEmpty() : bool O(1)

Deque is a queue which elements can be added to or removed from either the front (head) or back (tail). This structure is a implementation of a head-tail doubly linkedlist.

Method Complexity
AddFirst(value) O(1)
GetFirst() int O(1)
RemoveFirst() int O(1)
AddLast(value) O(1)
GetLast() int O(1)
RemoveLast() int O(1)
Size() : int O(1)
IsEmpty() : bool O(1)

dsa-golang's People

Contributors

leandersonandre avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.