Kick Start – golang

There are many reasons to learn and use golang in current projects. Do you want to start your golang journey? Well, let’s kick start ! I have created a repo to add few samples of golang codes which may help you in your journey.Feel free to connect me if you need any help on golang projects.
You can start your golang 101 with below bubble sort example. Keep following my repo for further sample push

package main

import "fmt"

func main() {

    /* Array for sorting */
	var numbers = []int{5, 6, 8, 10, 23, 6, 7, 7, 7}
	var i, j int

	for i = 0; i < len(numbers)-1; i++ {
		for j = i + 1; j < len(numbers); j++ {
			if numbers[i] > numbers[j] {
				var temp = numbers[i]
				numbers[i] = numbers[j]
				numbers[j] = temp

	for j = 0; j < len(numbers); j++ {
		fmt.Printf("%d,", numbers[j])

custom linkedList implementation

Computing systems are concerned with the storage and retrieval of information.For systems to be economical the data must be organized (into data structures) in such a way as to support efficient manipulation (by algorithms).Choosing the wrong algorithms and data structures makes a program slow at best and unmaintainable and insecure at worst.

Lets take an example of purchase order of an e-commerce store. If purchase order implemented as custom linkedlist then we can take benefit of

a) constant-time insertions/deletions from the list
b) maintaining many versions of purchase order without any additional complexity.
c) to insert items in the middle of the list (such as a priority queue)
d) many priority queue based operation
e) In-memory operations

below is one such implementation

package com;

import java.util.Iterator;

public class LinkedListDemo {

	public static void main(String[] args) {

		LinkedList lnkls = new LinkedList();
		System.out.println("Total added items :" + lnkls.size);
		Iterator<LinkedList.Node> it = lnkls.iterator();

		System.out.println("****** Items of LinkedList ******");

		while (it.hasNext()) {


class LinkedList implements Iterable<LinkedList.Node>, Iterator<LinkedList.Node> {

	Node head;
	Node lastNode;
	Node visitorNode;

	int size = 0;
	int visited = 0;

	public LinkedList() {

	public void add(Object o) {
		Node newNode = new Node(o);

		if (this.head == null) {
			this.lastNode = this.head = newNode;
		} else { = newNode;
			this.lastNode = newNode;
		System.out.println("Added " + newNode);

	public Iterator<LinkedList.Node> iterator() {
		visitorNode = lastNode = head;
		return this;

	public boolean hasNext() {
		if (visited++ < size)
			return true;
			return false;

	public Node next() {
		Node visitedNode = lastNode;
		lastNode =;
		return visitedNode;

	class Node {

		Object objValue;
		Node next;

		public Node(Object o) {
			this.objValue = o; = null;

		public String toString() {
			return objValue.toString();

 // additional operational and supportive APIs for custom linkedlist