diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..29c05eb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+node_modules/
+package.json
+package-lock.json
+build/
+DS_Store
+plugins/
\ No newline at end of file
diff --git a/experiment-descriptor.json b/experiment-descriptor.json
index 10b24f4..cd17bb9 100755
--- a/experiment-descriptor.json
+++ b/experiment-descriptor.json
@@ -2,6 +2,7 @@
"unit-type": "lu",
"label": "",
"basedir": ".",
+ "LaTeXinMD": true,
"units": [
{
"unit-type": "aim"
@@ -47,7 +48,13 @@
"label": "Posttest",
"unit-type": "task",
"content-type": "assesment"
+ },
+ {
+ "target": "references.html",
+ "source": "references.md",
+ "label": "References",
+ "unit-type": "task",
+ "content-type": "text"
}
]
}
-
diff --git a/experiment/aim.md b/experiment/aim.md
index 13b54fa..cfd23a2 100644
--- a/experiment/aim.md
+++ b/experiment/aim.md
@@ -1,48 +1 @@
-Welcome to recursion. One of the most easiest things to code but really hard to debug! Recursion is a very powerful tool to solve problems. All loops(while, for , do while) can be simulated using recursion. Also the main step of the dynamic programming is recursion which is useful in solving many algorithmically difficult problems. Lets solve some problems now.
-
-**Problem 1:**
-
-You are given scales for weighing loads. On the left side lies a single stone of known weight W < 2N. You own a set of N different weights, weighing 1, 2, 4, ..., 2N-1 units of mass respectively. Determine how many possible ways there are of placing some weights on the sides of the scales, so as to balance them (put them in a state of equilibrium).
-
-
-**Input Specification**
-
-The input line contains two integers: N W, where N denotes the number of weights and W represents the weight to be placed on the left side.
-
-
-**Output Specification**
-
-Output must be a single integer denoting the number ways in which one can balance the weight W by placing weights on any side.
-
-
-**Sample Input and Output**
-
-Input: 2 4
-Output: 3
-Input: 5 10
-Output: 14
-
-
-**Problem 2:**
-
-Given a weighing pan, n weights and a destination weight D, print "YES" or "NO" depending whether you can weight D using other weights given.
-
-
-**Input Specification**
-
-Input begins with numbers of weights n, then n values denoting mass of each weight and then in the end destination weight D.
-
-
-**Output Specification**
-
-As the output, print "YES" if it is possible to weight D, otherwise "NO".
-
-
-**Sample Input and Output**
-
-Input: 3 1 3 4 2
-Output: YES
-Input: 2 1 3 5
-Output: NO
-
-
+To understand and apply the principles of recursion to solve computational problems, analyze recursive processes, and appreciate the power and elegance of recursive thinking in computer programming.
diff --git a/experiment-image.png b/experiment/images/experiment-image.png
similarity index 100%
rename from experiment-image.png
rename to experiment/images/experiment-image.png
diff --git a/experiment/objective.md b/experiment/objective.md
index d5ad2dd..41c1861 100644
--- a/experiment/objective.md
+++ b/experiment/objective.md
@@ -1 +1,5 @@
-- To learn to solve problems related to Recursion using Computer Programming.
\ No newline at end of file
+- To understand the concept of recursion and identify problems that can be solved recursively.
+- To develop and implement recursive algorithms for classic computational problems.
+- To analyze the flow and efficiency of recursive solutions, including base cases and recursive cases.
+- To compare recursion with iteration and recognize when recursion is advantageous.
+- To strengthen problem-solving skills by applying recursion to real-world scenarios and algorithmic challenges.
diff --git a/experiment/posttest.json b/experiment/posttest.json
index 25ad02a..a798f0b 100644
--- a/experiment/posttest.json
+++ b/experiment/posttest.json
@@ -1,46 +1,175 @@
-[
-{"question":"1. A continue statement causes execution to skip to:",
-"answers":{
- "a":"the end of the program",
- "b":"the first statement after the loop",
- "c":"the statement following the continue statement",
- "d":"the next iteration of the loop"
- },
-"correctAnswer":"d"},
-
-{"question":"2. The statement i++; is equivalent to:",
-"answers":{
- "a":"i = i + i;",
- "b":"i = i + 1;",
- "c":"i = i - 1;",
- "d":"i - - ;"
- },
-"correctAnswer":"b"},
-
-{"question":"3. Another word for 'looping' is:",
-"answers":{
- "a":"recapitulation ",
- "b":"tintinabulation ",
- "c":"iteration",
- "d":"reiteration"
- },
-"correctAnswer":"c"},
-
-{"question":"4. Which looping process is best used when the number of iterations is known?",
-"answers":{
- "a":"for",
- "b":"while",
- "c":"do-while",
- "d":"all of the above"
- },
-"correctAnswer":"a"},
-
-{"question":"5. Which of the following is not an infinite loop.",
-"answers":{
- "a":"int i = 1 ; while ( 1 ) { i++ ; }",
- "b":"for( int i =1; i < 10 ; i--) printf('Hello World');",
- "c":"for(int i =1; i<100; i++) printf('Hello World');",
- "d":"int i = 0; do{ i-- printf('%d ',i); }while(i>0);"
- },
-"correctAnswer":"c"}
-]
+{
+ "version": 2.0,
+ "questions": [
+ {
+ "question": "1. Which of the following best describes a base case in recursion?",
+ "answers": {
+ "a": "A function that calls itself",
+ "b": "A variable declaration",
+ "c": "A condition where recursion stops",
+ "d": "A loop inside a function"
+ },
+ "correctAnswer": "c",
+ "explanations": {
+ "a": "Incorrect. That describes recursion, not the base case.",
+ "b": "Incorrect. Variables are unrelated.",
+ "c": "Correct. The base case is where recursion terminates.",
+ "d": "Incorrect. Loops are not required for recursion."
+ },
+ "difficulty": "beginner"
+ },
+ {
+ "question": "2. What is the output of the following recursive function call: factorial(3)?\nfunction factorial(n) { if (n == 0) return 1; else return n * factorial(n-1); }",
+ "answers": {
+ "a": "0",
+ "b": "1",
+ "c": "3",
+ "d": "6"
+ },
+ "correctAnswer": "d",
+ "explanations": {
+ "a": "Incorrect. 0 is not the result.",
+ "b": "Incorrect. 1 is the base case result.",
+ "c": "Incorrect. 3 is not the result of factorial(3).",
+ "d": "Correct. 3 * 2 * 1 = 6."
+ },
+ "difficulty": "beginner"
+ },
+ {
+ "question": "3. Which of the following is NOT a property of recursion?",
+ "answers": {
+ "a": "Always faster than iteration",
+ "b": "Requires a base case",
+ "c": "Can be used to solve combinatorial problems",
+ "d": "Can lead to stack overflow"
+ },
+ "correctAnswer": "a",
+ "explanations": {
+ "a": "Incorrect. Recursion is not always faster than iteration.",
+ "b": "Correct. Recursion requires a base case.",
+ "c": "Correct. Recursion is used in combinatorial problems.",
+ "d": "Correct. Stack overflow is a risk in recursion."
+ },
+ "difficulty": "intermediate"
+ },
+ {
+ "question": "4. In the context of recursion, what is a call stack overflow?",
+ "answers": {
+ "a": "When a function returns a value",
+ "b": "When a loop runs infinitely",
+ "c": "When too many recursive calls exhaust the stack memory",
+ "d": "When a variable is not initialized"
+ },
+ "correctAnswer": "c",
+ "explanations": {
+ "a": "Incorrect. Returning a value does not cause overflow.",
+ "b": "Incorrect. Infinite loops are not stack overflows.",
+ "c": "Correct. Too many recursive calls can exhaust stack memory.",
+ "d": "Incorrect. Variable initialization is unrelated."
+ },
+ "difficulty": "intermediate"
+ },
+ {
+ "question": "5. Which of the following problems is best solved using recursion?",
+ "answers": {
+ "a": "Variable assignment",
+ "b": "Simple addition",
+ "c": "Finding the maximum in an array",
+ "d": "Tower of Hanoi"
+ },
+ "correctAnswer": "d",
+ "explanations": {
+ "a": "Incorrect. Assignment does not require recursion.",
+ "b": "Incorrect. Addition is a simple operation.",
+ "c": "Incorrect. Maximum can be found iteratively.",
+ "d": "Correct. Tower of Hanoi is a classic recursive problem."
+ },
+ "difficulty": "intermediate"
+ },
+ {
+ "question": "6. What is the main advantage of tail recursion?",
+ "answers": {
+ "a": "It always runs faster",
+ "b": "It can be optimized to use less stack space",
+ "c": "It requires no base case",
+ "d": "It never terminates"
+ },
+ "correctAnswer": "b",
+ "explanations": {
+ "a": "Incorrect. Not always faster.",
+ "b": "Correct. Tail recursion can be optimized by compilers.",
+ "c": "Incorrect. Base case is still required.",
+ "d": "Incorrect. Tail recursion can terminate."
+ },
+ "difficulty": "advanced"
+ },
+ {
+ "question": "7. Which of the following recursive algorithms is used to solve the balancing weights problem?",
+ "answers": {
+ "a": "Sorting the weights",
+ "b": "Ignoring the weights",
+ "c": "Exploring all combinations of placing weights",
+ "d": "Adding all weights to one side"
+ },
+ "correctAnswer": "c",
+ "explanations": {
+ "a": "Incorrect. Sorting is not required.",
+ "b": "Incorrect. Ignoring weights does not solve the problem.",
+ "c": "Correct. The recursive solution explores all combinations.",
+ "d": "Incorrect. All weights on one side is not the only solution."
+ },
+ "difficulty": "advanced"
+ },
+ {
+ "question": "8. Which of the following is true about the subset sum problem in recursion?",
+ "answers": {
+ "a": "It only works for two weights",
+ "b": "It is not related to recursion",
+ "c": "It cannot be solved recursively",
+ "d": "It can be solved by considering all combinations recursively"
+ },
+ "correctAnswer": "d",
+ "explanations": {
+ "a": "Incorrect. It works for any number of weights.",
+ "b": "Incorrect. It is related to recursion.",
+ "c": "Incorrect. It can be solved recursively.",
+ "d": "Correct. Subset sum is a classic recursive problem."
+ },
+ "difficulty": "advanced"
+ },
+ {
+ "question": "9. What is the main risk of using recursion without careful design?",
+ "answers": {
+ "a": "All of the above",
+ "b": "Stack overflow",
+ "c": "Incorrect results",
+ "d": "Infinite loops"
+ },
+ "correctAnswer": "a",
+ "explanations": {
+ "a": "Correct. All are risks of poor recursion design.",
+ "b": "Correct. Stack overflow is a risk.",
+ "c": "Correct. Incorrect results are possible.",
+ "d": "Correct. Infinite loops can occur."
+ },
+ "difficulty": "advanced"
+ },
+ {
+ "question": "10. Which of the following is NOT a typical use case for recursion?",
+ "answers": {
+ "a": "Simple variable assignment",
+ "b": "Sorting algorithms like Merge Sort",
+ "c": "Solving combinatorial problems",
+ "d": "Tree traversal"
+ },
+ "correctAnswer": "a",
+ "explanations": {
+ "a": "Incorrect. Assignment does not require recursion.",
+ "b": "Correct. Merge Sort uses recursion.",
+ "c": "Correct. Combinatorial problems often use recursion.",
+ "d": "Correct. Tree traversal is a classic use of recursion."
+ },
+ "difficulty": "advanced"
+ }
+ ]
+}
diff --git a/experiment/pretest.json b/experiment/pretest.json
index 3f71cc3..3ec44fb 100644
--- a/experiment/pretest.json
+++ b/experiment/pretest.json
@@ -1,47 +1,175 @@
-[
-{"question":"1. The execution of a loop typically starts with:",
-"answers":{
- "a":"initialization statements",
- "b":"Loop body",
- "c":"test condition",
- "d":"update statements"
- },
-"correctAnswer":"a"},
-
-{"question":"2. The break statement is used to exit from:",
-"answers":{
- "a":"an if statement",
- "b":"a for loop",
- "c":"a program",
- "d":"the main( ) function"
- },
-"correctAnswer":"b"},
-
-{"question":"3. A do-while loop is useful when we want that the statements within the loop must be executed",
-"answers":{
- "a":"only once",
- "b":"At Least Once",
- "c":"More than once",
- "d":"None of the above"
- },
-"correctAnswer":"b"},
-
-{"question":"4. In what sequence the initialization, testing and execution of body is done in a do-while loop ",
-"answers":{
- "a":"Initialization, execution of body, testing",
- "b":"Execution of body, initialization, testing",
- "c":"Initialization, testing, execution of body",
- "d":"None of the above"
- },
-"correctAnswer":"a"},
-
-{"question":"5. Which looping process checks the test condition at the end of the loop?",
-"answers":{
- "a":"for",
- "b":"while",
- "c":"do-while",
- "d":"No looping peocess check condition at the end"
- },
-"correctAnswer":"c"}
-
-]
+{
+ "version": 2.0,
+ "questions": [
+ {
+ "question": "1. What is recursion in computer programming?",
+ "answers": {
+ "c": "A function calling itself",
+ "a": "A function calling another function",
+ "d": "A loop inside a function",
+ "b": "A function with no return value"
+ },
+ "correctAnswer": "c",
+ "explanations": {
+ "c": "Correct. Recursion is when a function calls itself.",
+ "a": "Incorrect. That is function composition, not recursion.",
+ "d": "Incorrect. Loops are not recursion.",
+ "b": "Incorrect. Return value is not related to recursion."
+ },
+ "difficulty": "beginner"
+ },
+ {
+ "question": "2. Which of the following is essential for a recursive function to work correctly?",
+ "answers": {
+ "d": "A base case",
+ "b": "A loop",
+ "a": "A global variable",
+ "c": "A print statement"
+ },
+ "correctAnswer": "d",
+ "explanations": {
+ "d": "Correct. A base case prevents infinite recursion.",
+ "b": "Incorrect. Loops are not required for recursion.",
+ "a": "Incorrect. Global variables are not required.",
+ "c": "Incorrect. Print statements are not required."
+ },
+ "difficulty": "beginner"
+ },
+ {
+ "question": "3. What will happen if a recursive function does not have a base case?",
+ "answers": {
+ "b": "It will run infinitely or cause a stack overflow",
+ "d": "It will return 0",
+ "a": "It will print nothing",
+ "c": "It will run faster"
+ },
+ "correctAnswer": "b",
+ "explanations": {
+ "b": "Correct. Without a base case, recursion never stops and causes a stack overflow.",
+ "d": "Incorrect. It does not return 0 by default.",
+ "a": "Incorrect. Output is not guaranteed to be nothing.",
+ "c": "Incorrect. Infinite recursion is not faster."
+ },
+ "difficulty": "beginner"
+ },
+ {
+ "question": "4. Which of the following problems is best solved using recursion?",
+ "answers": {
+ "c": "Calculating factorial of a number",
+ "a": "Printing Hello World",
+ "d": "Adding two numbers",
+ "b": "Assigning a value to a variable"
+ },
+ "correctAnswer": "c",
+ "explanations": {
+ "c": "Correct. Factorial is a classic recursive problem.",
+ "a": "Incorrect. Printing does not require recursion.",
+ "d": "Incorrect. Addition is a simple operation.",
+ "b": "Incorrect. Assignment does not require recursion."
+ },
+ "difficulty": "beginner"
+ },
+ {
+ "question": "5. What is the base case in the recursive computation of factorial(n)?",
+ "answers": {
+ "b": "n == 0",
+ "a": "n == 1",
+ "d": "n < 0",
+ "c": "n > 1"
+ },
+ "correctAnswer": "b",
+ "explanations": {
+ "b": "Correct. The factorial of 0 is defined as 1, which is the base case.",
+ "a": "Incorrect. n == 1 is not the standard base case, though factorial(1) = 1.",
+ "d": "Incorrect. Factorial is not defined for negative numbers.",
+ "c": "Incorrect. n > 1 is not a base case."
+ },
+ "difficulty": "beginner"
+ },
+ {
+ "question": "6. Which of the following best describes the call stack in recursion?",
+ "answers": {
+ "d": "A structure that keeps track of active function calls",
+ "c": "A list of variables",
+ "a": "A type of loop",
+ "b": "A sorting algorithm"
+ },
+ "correctAnswer": "d",
+ "explanations": {
+ "d": "Correct. The call stack tracks recursive calls.",
+ "c": "Incorrect. Variables are not the call stack.",
+ "a": "Incorrect. Loops are not the call stack.",
+ "b": "Incorrect. Sorting is unrelated."
+ },
+ "difficulty": "intermediate"
+ },
+ {
+ "question": "7. Which of the following is a disadvantage of recursion?",
+ "answers": {
+ "b": "It can use more memory due to the call stack",
+ "a": "It always runs faster than iteration",
+ "d": "It cannot solve any problems",
+ "c": "It is never used in practice"
+ },
+ "correctAnswer": "b",
+ "explanations": {
+ "b": "Correct. Recursion can use more memory than iteration.",
+ "a": "Incorrect. Recursion is not always faster.",
+ "d": "Incorrect. Recursion solves many problems.",
+ "c": "Incorrect. Recursion is widely used."
+ },
+ "difficulty": "intermediate"
+ },
+ {
+ "question": "8. Which of the following is an example of a divide-and-conquer algorithm that uses recursion?",
+ "answers": {
+ "a": "Bubble Sort",
+ "b": "Assignment",
+ "c": "Merge Sort",
+ "d": "Linear Search"
+ },
+ "correctAnswer": "c",
+ "explanations": {
+ "a": "Incorrect. Bubble Sort is iterative.",
+ "b": "Incorrect. Assignment is not an algorithm.",
+ "c": "Correct. Merge Sort is a classic recursive algorithm.",
+ "d": "Incorrect. Linear Search is usually iterative."
+ },
+ "difficulty": "intermediate"
+ },
+ {
+ "question": "9. What is tail recursion?",
+ "answers": {
+ "a": "A recursive call inside a loop",
+ "b": "A recursive call with multiple parameters",
+ "c": "A recursive call with no base case",
+ "d": "A recursive call that is the last operation in the function"
+ },
+ "correctAnswer": "d",
+ "explanations": {
+ "a": "Incorrect. Loops are not required.",
+ "b": "Incorrect. Parameters do not define tail recursion.",
+ "c": "Incorrect. Base case is unrelated.",
+ "d": "Correct. Tail recursion means the recursive call is the last thing executed."
+ },
+ "difficulty": "advanced"
+ },
+ {
+ "question": "10. Which of the following problems can be solved using recursion?",
+ "answers": {
+ "a": "Balancing weights on a scale",
+ "b": "Tower of Hanoi",
+ "c": "All of the above",
+ "d": "Fibonacci sequence"
+ },
+ "correctAnswer": "c",
+ "explanations": {
+ "a": "Correct. Balancing weights is solved recursively.",
+ "b": "Correct. Tower of Hanoi is solved recursively.",
+ "c": "Correct. All of these can be solved using recursion.",
+ "d": "Correct. Fibonacci sequence is solved recursively."
+ },
+ "difficulty": "advanced"
+ }
+ ]
+}
diff --git a/experiment/procedure.md b/experiment/procedure.md
index dabc1aa..61cb1bf 100644
--- a/experiment/procedure.md
+++ b/experiment/procedure.md
@@ -1 +1,26 @@
-For each problem you have to write a program in C or C++. Each question is evaluted on test cases. An answer is correct only when all the test cases are cleared.
+To successfully complete the simulation for this experiment, follow these steps:
+
+1. **Read the Problem Statement:**
+ - Carefully read the description and requirements for each problem.
+
+2. **Fill in the Blanks:**
+ - For each problem, you will be shown a partially completed C/C++ code with several blanks.
+ - Enter the correct code for each blank based on your understanding of the problem.
+
+3. **Use Hints if Needed:**
+ - If you are stuck, use the 'Hint' dropdown to get step-by-step guidance for each blank.
+
+4. **Compile and Run:**
+ - Click the 'Compile' button to check your answers for the blanks.
+ - If all blanks are correct, the 'Run' button will be enabled.
+ - Click 'Run' to see the expected output for the completed code.
+
+5. **View Results and Feedback:**
+ - After compiling, you will see feedback for each blank, indicating which are correct and which need revision.
+ - The runtime output will show what the program would produce for sample inputs.
+
+6. **Iterate and Improve:**
+ - Modify your answers as needed and re-compile until all blanks are correct.
+
+**Note:**
+Your answer is considered correct only when all blanks are filled correctly. Make sure to follow the input/output format and logic strictly.
diff --git a/experiment/references.md b/experiment/references.md
index b15b47e..1ea8bd9 100644
--- a/experiment/references.md
+++ b/experiment/references.md
@@ -1 +1,16 @@
-### Link your references in here
\ No newline at end of file
+1. **Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein, Introduction to Algorithms (3rd Edition).**
+ - Comprehensive coverage of recursion, divide-and-conquer, and algorithmic problem solving.
+
+2. **Steven S. Skiena, The Algorithm Design Manual.**
+ - Practical insights and examples of recursive algorithms in real-world problems.
+
+3. **Wikipedia: Recursion (Computer Science)**
+ - https://en.wikipedia.org/wiki/Recursion_(computer_science)
+ - Overview, examples, and applications of recursion.
+
+4. **NPTEL: Programming, Data Structures and Algorithms**
+ - https://nptel.ac.in/courses/106/106/106106145/
+ - Video lectures and notes on recursion and algorithmic thinking.
+
+5. **Paul Zeitz, The Art and Craft of Problem Solving.**
+ - Problem-solving strategies and recursive thinking.
diff --git a/experiment/simulation/css/main.css b/experiment/simulation/css/main.css
index 20bf42b..5f004e7 100644
--- a/experiment/simulation/css/main.css
+++ b/experiment/simulation/css/main.css
@@ -1 +1,105 @@
-/* You CSS goes in here */
\ No newline at end of file
+.simulation-center-wrapper {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ max-width: 1200px;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+@media (max-width: 991px) {
+ .simulation-center-wrapper {
+ max-width: 100%;
+ margin-left: 0;
+ margin-right: 0;
+ align-items: stretch;
+ }
+}
+
+.feedback-correct {
+ color: #218838;
+ font-weight: 500;
+}
+.feedback-incorrect {
+ color: #c82333;
+ font-weight: 500;
+}
+.feedback-expected {
+ color: #004085;
+ font-size: 0.98em;
+ margin-left: 0.5em;
+}
+.feedback-all-correct {
+ color: #155724;
+ font-weight: bold;
+ margin-top: 0.5em;
+}
+
+body {
+ background: #f8f9fa;
+}
+
+.simulation-container {
+ max-width: 1200px;
+}
+
+.problem-statement {
+ font-size: 1.1rem;
+ background: #fff;
+ border-radius: 6px;
+ padding: 1rem;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
+ margin-bottom: 1rem;
+}
+
+.code-area {
+ background: #23272f;
+ color: #f8f8f2;
+ border-radius: 6px;
+ padding: 1rem 1.5rem;
+ font-family: "Fira Mono", "Consolas", monospace;
+ font-size: 1rem;
+ overflow-x: auto;
+ margin-bottom: 1rem;
+}
+
+.template-line {
+ white-space: pre;
+ margin-bottom: 0.1rem;
+}
+
+.blank-input,
+.code-blank {
+ width: 120px;
+ margin: 0 4px;
+ border-radius: 4px;
+ border: 1px solid #ccc;
+ padding: 2px 6px;
+ font-family: inherit;
+ font-size: 1rem;
+ display: inline-block;
+}
+
+.hints-area {
+ background: #fff;
+ border-radius: 6px;
+ padding: 1rem;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
+}
+
+.hint {
+ background: #e9ecef;
+ border-radius: 4px;
+ padding: 0.5em 0.75em;
+ margin-bottom: 0.5em;
+ font-size: 1rem;
+}
+
+.output-area {
+ background: #fff;
+ border-radius: 6px;
+ padding: 0.75rem 1rem;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
+ margin-bottom: 1rem;
+ min-height: 2.2em;
+}
diff --git a/experiment/simulation/exp6/12.c b/experiment/simulation/exp6/12.c
deleted file mode 100755
index 1627862..0000000
--- a/experiment/simulation/exp6/12.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include
-int N;
-
-/*the variable index denotes that I have weights
- 2^index , 2^(index+1), 2^(index+2),...,2^(N-1)
- and W denotes the weight we need to achieve.
-*/
-int no_ways(int W,int index){
-
- /*If need to achieve W=0 we simply dont choose any weights
- and it is a solution.. so we return 1.
- */
-
- /*
- if index==N we could not achieve the weight W and so we return 0
-
- */
- if(!W)
- return 1;
- if(index==N)
- return 0;
-
- int i,ans=0;
- /*
- The variable i indicates that I have choosen
- i weights of 2^index
- If I choose i weights of 2^index the
- weight we need to achieve becomes W-i*(2^index)
- */
- for(i=0;i*(1<=0 , x2>=0,...xN>=0.
- Hint3:
- We reformulate the task in a slightly different
- way. How many ways can we achieve a weight W
- given that we can choose any weights from
- 2^i,2^(i+1),..2^(N-1). Suppose we choose x(i)
- number of weights of type 2^i we would need to
- achieve a weight of W-x(i)*2^i from 2^(i+1),2^(i+2),
- ...,2^(N-1) which leads us to the simple recursive
- equation no_ways[W][i] = sigma(no_ways[W-x*2^i][i+1])
- , x varies from 0 to W/2^i
-
-*/
diff --git a/experiment/simulation/exp6/Experiment.html b/experiment/simulation/exp6/Experiment.html
deleted file mode 100644
index 12f98b9..0000000
--- a/experiment/simulation/exp6/Experiment.html
+++ /dev/null
@@ -1,215 +0,0 @@
-
-
-
-
-
-
-
-
- Welcome to Virtual Labs - A MHRD Govt of india Initiative
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Thanks for using Virtual Labs. Your opinion is valuable to us. To help us improve, we'd like to ask you a few questions about your experience. It will only take 3 minutes and your answers will help us make Virtual Labs better for you and other users.
-
#include<stdio.h>
-int no_ways(int W,int index){
-
- ->termination conditions
- ->for each possibility
- of choosing i items of weight
- 2^index find the number of solutions
-
- ->return the total number of solutions
-
-}
-int main(){
-->scan N,W
-->call the recursive function with appropriate
- parameters
-}
-
-
\ No newline at end of file
diff --git a/experiment/simulation/exp6/Hints1/Hint_2.html b/experiment/simulation/exp6/Hints1/Hint_2.html
deleted file mode 100755
index 4901bba..0000000
--- a/experiment/simulation/exp6/Hints1/Hint_2.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
#include<stdio.h>
-int no_ways(int W,int index){
-
- ->termination conditions
-
- for i=0;i*2^index<=W;i++
- ->choosing i items each
- of weight 2^index
- no_ways(W-i*2^index,index+1)
-
- ->return the total number of solutions
-
-}
-int main(){
-->scan N,W
-->call the recursive function with appropriate
- parameters
-}
-
-
\ No newline at end of file
diff --git a/experiment/simulation/exp6/Hints1/Hint_3.html b/experiment/simulation/exp6/Hints1/Hint_3.html
deleted file mode 100755
index 563e1d8..0000000
--- a/experiment/simulation/exp6/Hints1/Hint_3.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
#include<stdio.h>
-int no_ways(int W,int index){
-
- ->termination conditions
-
- int ans = 0;
- for i=0;i*2^index<=W;i++
- ->choosing i items each
- of weight 2^index
- ans+=no_ways(W-i*2^index,index+1)
-
- ->return ans
-
-}
-int main(){
-->scan N,W
-->call the recursive function with appropriate
- parameters
-}
-
-
\ No newline at end of file
diff --git a/experiment/simulation/exp6/Hints1/Hint_4.html b/experiment/simulation/exp6/Hints1/Hint_4.html
deleted file mode 100755
index 049446a..0000000
--- a/experiment/simulation/exp6/Hints1/Hint_4.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/experiment/simulation/exp6/Hints2/Hint_0.html b/experiment/simulation/exp6/Hints2/Hint_0.html
deleted file mode 100755
index 824a20e..0000000
--- a/experiment/simulation/exp6/Hints2/Hint_0.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/experiment/simulation/exp6/Hints2/Hint_1.html b/experiment/simulation/exp6/Hints2/Hint_1.html
deleted file mode 100755
index 4970826..0000000
--- a/experiment/simulation/exp6/Hints2/Hint_1.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
#include<stdio.h>
-int isPossible(int N,int D,int *weight)
- -> Trivial/termination cases handled first
- like when N=0 or D=0
- ->try all possibilities with the given weight
- weight[N-1]
-int main(){
- ->scan N and weights and call isPossible
- function
-}
-
-
\ No newline at end of file
diff --git a/experiment/simulation/exp6/Hints2/Hint_2.html b/experiment/simulation/exp6/Hints2/Hint_2.html
deleted file mode 100755
index 004cb28..0000000
--- a/experiment/simulation/exp6/Hints2/Hint_2.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
#include<stdio.h>
-
-->Assume a weight of D on right PAN
-int isPossible(int N,int D,int *weight){
- -> Trivial/termination cases handled first
- like when N=0 or D=0
- -> Explore the possibilities
- keeping weight on right side of PAN
- ->isPossible(N-1,D+weight[N-1],weight)
- keeping the weight on left side of PAN
- ->isPossible(N-1,D-weight[N-1],weight)
- Not keeping the weight on any PAN
- ->isPossible(N-1,D,weight)
-}
-
-int main(){
- ->scan N and weights and call isPossible
- function
-}
-
-
\ No newline at end of file
diff --git a/experiment/simulation/exp6/Hints2/Hint_3.html b/experiment/simulation/exp6/Hints2/Hint_3.html
deleted file mode 100755
index 96f1012..0000000
--- a/experiment/simulation/exp6/Hints2/Hint_3.html
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
#include<stdio.h>
-
-->Assume a weight of D on right PAN
-int isPossible(int N,int D,int *weight){
- -> Trivial/termination cases handled first
- like when N=0 or D=0
- return isPossible(N-1,D+weight[N-1],weight)||isPossible(N-1,D-weight[N-1],weight)||isPossible(N-1,D,weight)
-}
-
-int main(){
- ->scan N and weights and call isPossible
- function
-}
-
-
\ No newline at end of file
diff --git a/experiment/simulation/exp6/Hints2/Hint_4.html b/experiment/simulation/exp6/Hints2/Hint_4.html
deleted file mode 100755
index b885808..0000000
--- a/experiment/simulation/exp6/Hints2/Hint_4.html
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-Welcome to recursion. One of the most easiest things to code but really hard to debug! Recursion is a very powerful tool to solve problems. All loops(while, for , do while) can be simulated using recursion. Also the main step of the dynamic programming is recursion which is useful in solving many algorithmically difficult problems. Lets solve some problems now.
-
-
-
-
Problem 1:
-
-
-You are given scales for weighing loads. On the left side lies a single stone of known weight W < 2N. You own a set of N different weights, weighing 1, 2, 4, ..., 2N−1 units of mass respectively. Determine how many possible ways there are of placing some weights on the sides of the scales, so as to balance them (put them in a state of equilibrium).
-
-
-
Input Specification
-
-The input line contains two integers: N W, where N denotes the number of weights and W represents the weight to be placed on the left side.
-
-
-
Output Specification
-
-Output must be a single integer denoting the number ways in which one can balance the weight W by placing weights on any side.
-
-
-
Sample Input and Output
-
-Input: 2 4
-Output: 3
-Input: 5 10
-Output: 14
-
-
-
-
-
Problem 2:
-
-Given a weighing pan, n weights and a destination weight D, print “YES” or “NO” depending whether you can weight D using other weights given.
-
-
-
Input Specification
-
-Input begins with numbers of weights n, then n values denoting mass of each weight and then in the end destination weight D.
-
-
-
Output Specification
-
-As the output, print “YES” if it is possible to weight D, otherwise “NO”.
-
- For each problem you have to write a program in C or C++. Each question is evaluted on test cases. An answer is correct only when all the test cases are cleared.
-
- To learn to solve problems related to Recursion using Computer Programming.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/experiment/simulation/exp6/Problem1/12.c b/experiment/simulation/exp6/Problem1/12.c
deleted file mode 100755
index 1627862..0000000
--- a/experiment/simulation/exp6/Problem1/12.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include
-int N;
-
-/*the variable index denotes that I have weights
- 2^index , 2^(index+1), 2^(index+2),...,2^(N-1)
- and W denotes the weight we need to achieve.
-*/
-int no_ways(int W,int index){
-
- /*If need to achieve W=0 we simply dont choose any weights
- and it is a solution.. so we return 1.
- */
-
- /*
- if index==N we could not achieve the weight W and so we return 0
-
- */
- if(!W)
- return 1;
- if(index==N)
- return 0;
-
- int i,ans=0;
- /*
- The variable i indicates that I have choosen
- i weights of 2^index
- If I choose i weights of 2^index the
- weight we need to achieve becomes W-i*(2^index)
- */
- for(i=0;i*(1<=0 , x2>=0,...xN>=0.
- Hint3:
- We reformulate the task in a slightly different
- way. How many ways can we achieve a weight W
- given that we can choose any weights from
- 2^i,2^(i+1),..2^(N-1). Suppose we choose x(i)
- number of weights of type 2^i we would need to
- achieve a weight of W-x(i)*2^i from 2^(i+1),2^(i+2),
- ...,2^(N-1) which leads us to the simple recursive
- equation no_ways[W][i] = sigma(no_ways[W-x*2^i][i+1])
- , x varies from 0 to W/2^i
-
-*/
diff --git a/experiment/simulation/exp6/Problem1/Problem1_1.in b/experiment/simulation/exp6/Problem1/Problem1_1.in
deleted file mode 100755
index 795ed34..0000000
--- a/experiment/simulation/exp6/Problem1/Problem1_1.in
+++ /dev/null
@@ -1 +0,0 @@
-5 10
diff --git a/experiment/simulation/exp6/Problem1/Problem1_1.out b/experiment/simulation/exp6/Problem1/Problem1_1.out
deleted file mode 100755
index 8351c19..0000000
--- a/experiment/simulation/exp6/Problem1/Problem1_1.out
+++ /dev/null
@@ -1 +0,0 @@
-14
diff --git a/experiment/simulation/exp6/Problem1/Problem1_2.in b/experiment/simulation/exp6/Problem1/Problem1_2.in
deleted file mode 100755
index 9290688..0000000
--- a/experiment/simulation/exp6/Problem1/Problem1_2.in
+++ /dev/null
@@ -1 +0,0 @@
-4 6
diff --git a/experiment/simulation/exp6/Problem1/Problem1_2.out b/experiment/simulation/exp6/Problem1/Problem1_2.out
deleted file mode 100755
index 1e8b314..0000000
--- a/experiment/simulation/exp6/Problem1/Problem1_2.out
+++ /dev/null
@@ -1 +0,0 @@
-6
diff --git a/experiment/simulation/exp6/Problem1/Problem1_3.in b/experiment/simulation/exp6/Problem1/Problem1_3.in
deleted file mode 100755
index dbe3ea5..0000000
--- a/experiment/simulation/exp6/Problem1/Problem1_3.in
+++ /dev/null
@@ -1 +0,0 @@
-5 15
diff --git a/experiment/simulation/exp6/Problem1/Problem1_3.out b/experiment/simulation/exp6/Problem1/Problem1_3.out
deleted file mode 100755
index 6f4247a..0000000
--- a/experiment/simulation/exp6/Problem1/Problem1_3.out
+++ /dev/null
@@ -1 +0,0 @@
-26
diff --git a/experiment/simulation/exp6/Problem1/Problem1_4.in b/experiment/simulation/exp6/Problem1/Problem1_4.in
deleted file mode 100755
index 5cadfb4..0000000
--- a/experiment/simulation/exp6/Problem1/Problem1_4.in
+++ /dev/null
@@ -1 +0,0 @@
-7 23
diff --git a/experiment/simulation/exp6/Problem1/Problem1_4.out b/experiment/simulation/exp6/Problem1/Problem1_4.out
deleted file mode 100755
index fff0a24..0000000
--- a/experiment/simulation/exp6/Problem1/Problem1_4.out
+++ /dev/null
@@ -1 +0,0 @@
-74
diff --git a/experiment/simulation/exp6/Problem1/Problem1_6.in b/experiment/simulation/exp6/Problem1/Problem1_6.in
deleted file mode 100755
index 6af3f94..0000000
--- a/experiment/simulation/exp6/Problem1/Problem1_6.in
+++ /dev/null
@@ -1 +0,0 @@
-4 10
diff --git a/experiment/simulation/exp6/Problem1/Problem1_6.out b/experiment/simulation/exp6/Problem1/Problem1_6.out
deleted file mode 100755
index 8351c19..0000000
--- a/experiment/simulation/exp6/Problem1/Problem1_6.out
+++ /dev/null
@@ -1 +0,0 @@
-14
diff --git a/experiment/simulation/exp6/Problem1/a.out b/experiment/simulation/exp6/Problem1/a.out
deleted file mode 100755
index 33f9e37..0000000
Binary files a/experiment/simulation/exp6/Problem1/a.out and /dev/null differ
diff --git a/experiment/simulation/exp6/Problem1/judgeCode.c b/experiment/simulation/exp6/Problem1/judgeCode.c
deleted file mode 100755
index 1627862..0000000
--- a/experiment/simulation/exp6/Problem1/judgeCode.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include
-int N;
-
-/*the variable index denotes that I have weights
- 2^index , 2^(index+1), 2^(index+2),...,2^(N-1)
- and W denotes the weight we need to achieve.
-*/
-int no_ways(int W,int index){
-
- /*If need to achieve W=0 we simply dont choose any weights
- and it is a solution.. so we return 1.
- */
-
- /*
- if index==N we could not achieve the weight W and so we return 0
-
- */
- if(!W)
- return 1;
- if(index==N)
- return 0;
-
- int i,ans=0;
- /*
- The variable i indicates that I have choosen
- i weights of 2^index
- If I choose i weights of 2^index the
- weight we need to achieve becomes W-i*(2^index)
- */
- for(i=0;i*(1<=0 , x2>=0,...xN>=0.
- Hint3:
- We reformulate the task in a slightly different
- way. How many ways can we achieve a weight W
- given that we can choose any weights from
- 2^i,2^(i+1),..2^(N-1). Suppose we choose x(i)
- number of weights of type 2^i we would need to
- achieve a weight of W-x(i)*2^i from 2^(i+1),2^(i+2),
- ...,2^(N-1) which leads us to the simple recursive
- equation no_ways[W][i] = sigma(no_ways[W-x*2^i][i+1])
- , x varies from 0 to W/2^i
-
-*/
diff --git a/experiment/simulation/exp6/Problem1/judgeCode.out b/experiment/simulation/exp6/Problem1/judgeCode.out
deleted file mode 100755
index 139692d..0000000
Binary files a/experiment/simulation/exp6/Problem1/judgeCode.out and /dev/null differ
diff --git a/experiment/simulation/exp6/Problem1/temp.out b/experiment/simulation/exp6/Problem1/temp.out
deleted file mode 100755
index 8351c19..0000000
--- a/experiment/simulation/exp6/Problem1/temp.out
+++ /dev/null
@@ -1 +0,0 @@
-14
diff --git a/experiment/simulation/exp6/Problem2/a.out b/experiment/simulation/exp6/Problem2/a.out
deleted file mode 100755
index f27d552..0000000
Binary files a/experiment/simulation/exp6/Problem2/a.out and /dev/null differ
diff --git a/experiment/simulation/exp6/Problem2/genInput.cpp b/experiment/simulation/exp6/Problem2/genInput.cpp
deleted file mode 100755
index 328193e..0000000
--- a/experiment/simulation/exp6/Problem2/genInput.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include