GithubHelp home page GithubHelp logo

generic_collections's Introduction

generic_collections

This project implements various generic data structures in Golang using generics (introduced in Go 1.18).

Supported Collections

  • Stack: A Last-In-First-Out (LIFO) data structure.

Installation

This project requires Go 1.18 or later to be installed. You can download and install it from the official website: Golang download.

Once Go is installed, clone this repository and run go mod init to initialize the Go module:

git clone https://your-github-url/generic_collections.git
cd generic_collections
go mod init github.com/your-username/generic_collections

Usage

Stack

package main

import (
	"fmt"

	"github.com/space-w-alker/generic_collections/stack"
)

func main() {
	s := make(stack.Stack[int], 10)
	s.Push(20)
	s.Push(9)
	v, _ := s.Pop()
	fmt.Printf("%v\n", v) //9
	v, _ = s.Pop()
	fmt.Printf("%v\n", v) //20
	_, err := s.Pop()
	fmt.Printf("%v\n", err) //true
}

Note: Replace "./stack" and "./set" with the actual import path based on your project structure.

Contributing

We welcome contributions to this project! Please feel free to fork the repository, make changes, and submit pull requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

generic_collections's People

Contributors

space-w-alker 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.