Open mubaris opened 6 years ago
@mubaris trying for stack, will do PR soon
sounds good @anandwana001
@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.
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())
}
}
send pr ,it looks good
Is this for everyone, if not can it be assigned to me?
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.
Alright I would like to work on making a linked list.
@falconis Sure
May I work on Graph ?
Yeah sure
Can I do the Binary Search tree?
yea sure @namantw
@mubaris @gauthamzz done Linked List implementation through PR #22
I want to work on heaps.
Data Structures to consider: