Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Important Data Structures in Go #5

Open
mubaris opened this issue Oct 27, 2017 · 14 comments · Fixed by #8
Open

Implement Important Data Structures in Go #5

mubaris opened this issue Oct 27, 2017 · 14 comments · Fixed by #8

Comments

@mubaris
Copy link
Member

mubaris commented Oct 27, 2017

Data Structures to consider:

  • Linked List
  • Stack
  • Queue
  • Tree
  • Graph
  • Binary Search Tree
  • Hash Table
  • Heap
  • Trie
@anandwana001
Copy link

@mubaris trying for stack, will do PR soon

@gauthamzz
Copy link
Member

sounds good @anandwana001

@anandwana001
Copy link

@mubaris @gauthamzz I got busy with my exams but free now. Here I tried to make a stack in Go. please if you could give some feedback.

img_20180107_094056

package main

import "fmt"

type Stack struct {
	size int
	top *Node
}

type Node struct {
	value string
	next *Node
}

func (s *Stack) Length() int {
  return s.size
}

func (s *Stack) Push(val string) {
	s.top = &Node{val, s.top}
	fmt.Printf("%v pushed to stack\n",val)
	s.size++
}

func (s *Stack) Pop() (val string) {
  if s.size > 0 {
    val, s.top = s.top.value, s.top.next
    s.size--
    return 
  }
  return
}

func main() {
	stack := &Stack{}
	
	stack.Push("10")
	stack.Push("20")
	stack.Push("30")
	
	fmt.Println()
	
	for stack.Length() > 0 {
		fmt.Printf("%s popped from stack\n", stack.Pop())
	}
}

@gauthamzz
Copy link
Member

send pr ,it looks good

@pani-vishal
Copy link

Is this for everyone, if not can it be assigned to me?

@mubaris
Copy link
Member Author

mubaris commented Jan 11, 2018

As of now only Stack and Queue are implemented.

Each Data Structure will get 10 points. If you would like to take this issue, Take Each DS one by one and comment you're working on it.

@pani-vishal
Copy link

Alright I would like to work on making a linked list.

@mubaris
Copy link
Member Author

mubaris commented Jan 11, 2018

@falconis Sure

@ProBeta1
Copy link

May I work on Graph ?

@gauthamzz
Copy link
Member

Yeah sure

@namantw
Copy link

namantw commented Jan 11, 2018

Can I do the Binary Search tree?

@gauthamzz
Copy link
Member

yea sure @namantw

@marshallKR7
Copy link
Contributor

marshallKR7 commented Jan 12, 2018

@mubaris @gauthamzz done Linked List implementation through PR #22

@arpitmisraw
Copy link

I want to work on heaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants