What do you want to save?
Add Code snippet
New code examples
-
Other 2022-03-17 04:25:04
Write a program to check whether a grammar is left recursive or not, if it is remove left recursion
1: #include<stdio.h> 2: #include<string.h> 3: #define SIZE 10 4: int main () { 5: char non_terminal; 6: char beta,alpha; 7: int num; 8: char production[10][SIZE]; 9: int index=3; /* starting of... Add solution -
C++ 2022-02-06 11:10:08
Write a CPP program to calculate sum of first N natural numbers
// Method 1: Mathematical -> Sum up numbers from 1 to n int sum(int n){ return (n * (n+1)) / 2; } // Method 2: Using a for-loop -> Sum up numbers from 1 to n int sum(int n){ int tempSum = 0; for (int i = n; i > 0; i--){ tempSum += ... Add solution -
Javascript 2022-02-02 08:55:31
express get all endpoints
const routes = {} function routerRecursion(middleware, pointer, currentName) { if (middleware.route) { // routes registered directly on the app if (!Array.isArray(pointer['routes'])) { pointer['routes'] = [] } const routeObj = { ... Add solution -
Python 2022-01-30 16:26:56
recursionerror maximum recursion depth
sys.setrecursionlimit(1500) Add solution