Git Product home page Git Product logo

kollection's Introduction

Kollection

A framework that provides some data structures to use on your project. The available structures are: Queue, Stack, Linked List and Doubly Linked List.

Functions and Attributes

Common

Every data structure has a set of common functions:

  • append
  • appendElementsOfArray
  • remove
  • firstIndexOf

and attributes:

  • isEmpty
  • count

Specific

Linked List and Doubly Linked List have extra functions:

  • appendFirst
  • appendAtIndex
  • removeFirst
  • removeLast
  • removeAtIndex

and attributes:

  • head
  • tail

Example

KStack<NSNumber *> * stack = [[KStack alloc] init];
NSLog(stack.isEmpty ? @"YES" : @"NO");

[stack append: @1];
[stack append: @2];
[stack append: @3];

NSLog(@"%@", stack);

NSLog(stack.isEmpty ? @"YES" : @"NO");

NSNumber * n = [stack remove];
NSLog(@"%@", n);
NSLog(@"%@", stack);

NSInteger index = [stack firstIndexOf: @1];
if (index == -1) {
    NSLog(@"Element not found.");
} else {
    NSLog(@"%ld", index);
}

Installation

Kollection is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Kollection'

Author

pedro0x53, daviaugusto222

License

Kollection is available under the MIT license. See the LICENSE file for more info.

kollection's People

Contributors

pedro0x53 avatar daviaugusto222 avatar

Watchers

 avatar  avatar

kollection's Issues

Bug Stack

  • Na documentação o nome da função descrita é removeAtIndex e no código tem uma função remove(at:)
  • Na pilha não deveria poder remover por index e a gente consegue fazer isso:

Captura de Tela 2021-07-28 às 11 49 30

- Ainda assim, mesmo que consiga remover, a gente acha que essa remoção tá incorreta, a gente pediu pra remover o índice 2, na nossa opinião o que deveria ser removido era o 6 e não o 5.

Sugestão de métodos

Está muito bom. Não consegui encontrar erros. Tenho só algumas sugestões de métodos que podem ser úteis:

  • um método para conversão da linked list em array.
  • um método para inverter a ordem no caso de doubly linked list.
  • não encontrei o método para dar append em um index específico, mas acredito que só não tenha dado tempo de implementar.

No mais, ficou muito bom. Parabéns!

Bugs Queue

  • Inconsistência em relação aos erros da função removeAtIndex, quando a gente tenta remover um número negativo ele quebra (o que a gente acha que é o comportamento correto), mas quando colocamos um número maior que o array, ele não remove mas também não quebra (o que a gente acha que devia ter o mesmo comportamento do anterior). Abaixo o print:

Captura de Tela 2021-07-28 às 11 32 38

  • Quando utilizamos a função appendElementsOfArray na fila, não funcionou. Print abaixo:

Captura de Tela 2021-07-28 às 11 30 40

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.