anuj-kumar-sharma / ds-algo Goto Github PK
View Code? Open in Web Editor NEWImplementation of Data structures and Algorithms at Apni Kaksha Java Placement Course
License: Apache License 2.0
Implementation of Data structures and Algorithms at Apni Kaksha Java Placement Course
License: Apache License 2.0
Hi Anuj, is there anything I can contribute in your repository? I would to like to help you in your mission to educate students and prepare them for placements. Please view my GitHub profile, and if you find me eligible, let me know how I can contribute to this repository.
Readme.md is an important file for any project hosted on a version control system. It helps the developers know more about the project, the setup process, and how to get started with the project.
We require to make a good and informative README for our DS-Algo project.
Don't know how to get started? Go through this article https://bulldogjob.com/news/449-how-to-write-a-good-readme-for-your-github-project
Line 63 in 0f60cf2
this exception is thrown by java compiler:
No enclosing instance of type Tree is accessible. Must qualify the allocation with an enclosing instance of type Tree (e.g. x.new A() where x is an instance of Tree).
I have copied this code from GeeksForGeeks and couldn't understand how this works.
please @Anuj-Kumar-Sharma bhaiya explain this code in your next video I think many of us will get help from this algorithm.
//java code
public class Subsequence {
// str : storse input string
// n : length of str
// curr : stores current permutation
// index : index in current(curr) permutation
static void printSubSeqRec(String str, int n, int index, String curr) {
System.out.println(curr);
for (int i = index + 1; i < n; i++) {
curr += str.charAt(i);
printSubSeqRec(str, n, i, curr);
// backtracking
curr = curr.substring(0, curr.length() - 1);
}
}
// Generates power set in lexicographic order
static void printSubSeq(String str) {
int index = -1;
String curr = "";
printSubSeqRec(str, str.length(), index, curr);
}
public static void main(String[] args) {
String str = "cab";
printSubSeq(str);
}
}
output of this code comes to be
c
ca
cab
cb
a
ab
b
I recommend you to run the below code as well for clarity where I have given different print statements.
public class SubsequenceRecursion {
// str : storse input string
// n : length of str
// curr : stores current permutation
// index : index in current(curr) permutation
static void printSubSeqRec(String str, int n, int index, String curr) {
System.out.println(curr+"\n");
for (int i = index + 1; i < n; i++) {
curr += str.charAt(i);
System.out.println("inside loop i is " + i);
System.out.println("inside loop index is " + index);
printSubSeqRec(str, n, i, curr);
System.out.println("Before backtracking " + curr);
System.out.println("i is " + i);
System.out.println("index is " + index);
// backtracking
curr = curr.substring(0, curr.length() - 1);
System.out.println("After backtracking " + curr);
}
}
// Generates power set in lexicographic order
static void printSubSeq(String str) {
int index = -1;
String curr = "";
printSubSeqRec(str, str.length(), index, curr);
}
public static void main(String[] args) {
String str = "cab";
printSubSeq(str);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.