Git Product home page Git Product logo

competitive-programming-in-java's Introduction

Competitive Programming in Java

cp_icon

  • This repository contains all the important data structures and algorithms that I use in Competitive Programming.

  • I have cis_pie as my username on all coding platforms. You can view me on Codechef or Codeforces.

  • Feel free to use these codes and let me know if you find any bug.

Links

Data Structures
Algorithms
Strings
Maths related

Miscellaneous

Fast IO for JAVA : Template.

  • Taken this template from legendary coder uwi

  • Java is a little bit slower than C++/C and the main factor behind this is slow console input/output.

  • Java's Scanner, as well as BufferedReader class, is too slow. So the best option is creating your own input-output classes.

  • I had never faced Time Limit Exceed Error (i.e Code takes too much time because of an inefficient/wrong algorithm ) after I started using this template.

  • To use this template you have to write all your code in solve() method.

  • From main() method we are calling solve() method which is supposed to solve the asked problem.

Documentation of methods from this template :

  • INPUT METHODS

    • int x=ni() -to input single number Short form of nextInt()

    • long x=nl() -to input long number nextLong()

    • double x=nd() - to input double values nextDouble()

    • String x=ns() - to input string nextString()

    • char x=nc() - to input character nextChar()

    • int[] arr=na(int n) -to input array of size n i.e parameter is integer with value n. It will allocate a new array and return its reference. nextArray()

    • char [][] matrix =nm(int n,int m) this is method is used tor inputing character matrix nextMatrix()

  • OUTPUT METHODS

    • pn(Object o) - method is used to print anthing on console the parameter is Object is you can pass anthing. It is similar as System.out.println().

    • p(Object o)- Similar as System.out.print()

  • UTILITY FUNCTIONS

    • int x=max( int[] arr) -it will find max element from array.

    • int y=min(int [] arr) it will find min element from array.

    • int g=gcd(x,y) for finding gcd.

    • Implemented pair class because there is no inbuilt pair class. You can use the pair in Hashed Collections as well as Tree Collections because hashCode() and compareTo() methods are implemented in this pair class.

competitive-programming-in-java's People

Contributors

kadam-tushar 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.