Code Monkey home page Code Monkey logo

chatroom's Introduction

14.07

Tasks:

  • find examples of using algos + data structures in the context of chatroom features

    • chat history search
    • word stats
    • chat censoring
    • word autocomplete
    • list of users with their status
    • friends - show 1st degree, 2nd degree
    • group chat suggestion
  • migrate to typescript

28.07

data structures:

  • trees
  • lists

TODO:

  • implement a list data structure
  • store messages in a list (in a variable)
  • implement methods:
    • find
    • map
    • forEach
    • first
    • last
    • prepend
    • remove
    • print

try not to google

null

{data: 'bla', next: null}

{ data: 'bla', next: { data: 'blabla', next: null } }

{ data: 'bla', next: { data: 'blabla', next: { data: 'hello', next: null } } }

does not modify list, but creates a new list make it functional

TODO:

expected prototype const <T, Acc>reduce(List: a, (acc: Acc, currentValue: T) => Acc, initialValue: Acc) => Acc

  • refine the data types type List = ListItem | null type ListItem = { data: T, next: List }

test examples

  1. reduce([], sum, 0) => 0
  2. summing the length of items accumulator doesn't have to be the same type as the list item! test it! like so: reduce(['abc', 'cbd'], (acc, elem) => acc + elem.length, 0) -> 6

TREE ๐ŸŒณ

trees make some operations more efficient and some operations less efficient

a node in a tree has an arbitrary amount of children a tree with maxinum of two children per node is a binary tree

TODO:

  • finish test for create tree
  • implement methods (TDD!)
    • add items (nearest available insertion spot)

    • print tree

      print like this: a

  • e
  • b
    • c
  • d

  • make a .toString function instead of print function
  • use the .toString function to test other functionalities (hide implementation details!)
  • implement a
  • null
  • b

โš–๏ธ TREE BALANCING

Homework

  • Implement AVL or red-black (!) balancing

๐Ÿ”Ž SEARCH

The idea: Store messages in a simple array Store words in a tree with arrays containing refences to the positions of messages in the words array In case of two words, perform two searches and then make an intersection of results to find messages that satisfy both searches

02.12

TODO:

  • change the way data is stored data.word data.positions not the key value thing

  • make the search function generic, not only for the key value thing search<K, T>(key: K, tree: <Tree<K, T>>, compare: () => number)

  • do the chat search implementation refer to the screenshot in root folder

improvement idea: get results for every word that starts with... then it's not word bound

// TODO:

  • message position should be array
  • pass messagePosition instead of message array to addMessage, return the added

chatroom's People

Contributors

badkuzu avatar kubagudz avatar etrobert 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.