Coder Social home page Coder Social logo

salestock-solution's Introduction

salestock-solution

Lang: Java (version 1.8)

01-AgeSorter-10M-Rows

  • How to produce sorted_age.txt: java AgeSorter < age.txt > sorted_age.txt

  • Execution time to produce sorted_age.txt time java AgeSorter < age.txt > sorted_age.txt real 0m59.964s user 0m26.941s sys 0m32.187s

  • How to generate age.txt python ageGen.py > age.txt

  • Execution time to generate age.txt time python ageGen.py > age.txt real 0m19.568s user 0m19.406s sys 0m0.092s

02-AgeSorter-7B-Rows

  • Solved using solution no.01 (no modification in file)
  • Execution time to do sorting 7B rows: 700 * 59.964 second = ~ 11.6 hours

03-BlacklistedUser-1M-Rows

  • Execution time of check_blacklist time java BlacklistChecker true real 0m1.902s user 0m4.024s sys 0m0.249s

  • How to generate blacklist.txt: python genBlacklisUser.py > blacklist.txt

  • Execution time to generate blacklist.txt time python genBlacklisUser.py > blacklist.txt real 0m7.346s user 0m7.268s sys 0m0.052s

Why use HashMap ?

A: In Java 8, when we have too many unequal keys which gives same hashcode(index), when the number of items in a hash bucket grows beyond certain threshold (TREEFY_THRESHOLD = 8), content of that bucket swicthes from using a 'linked list' of Entry objects to do a 'balanced tree'. This theoritically improves the worst-case performance from O(n) to O(log n). https://www.youtube.com/watch?v=c3RVW3KGIIE

salestock-solution's People

Contributors

m7013 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.