2906 - EE2310_Lab9 Scoreboard

Time

2023/11/23 08:15:00 2023/11/23 10:10:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
14123 EE2310_Lab9_1
14124 EE2310_Lab9_2
14125 EE2310_Lab9_3

14123 - EE2310_Lab9_1   

Description

/* -- Redo the palindrome problem using recursion. Modify the following code. -- */

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

/* uint8_t is just a char */
uint8_t is_palindrome(/* define your own arguments */) {
/*
 * Your code here
 */
}


int main(){
   char temp_c, str[32];
   int i=0, len=1;
   do{ // getting input from user
     scanf("%c", &temp_c);
     if(temp_c!=' ' && temp_c!='\n')
       str[i++] = temp_c;
   } while(temp_c!=' ' && temp_c!='\n' && i<30);
   len = i - 1; //current i is string length

   if(is_palindrome(/* add your own arguments */) {
     printf("a palindrome\n");
   } else {
     printf("not a palindrome\n");
   }
   return 0;
}

 

Input

abcba

Output

a palindrome

Sample Input  Download

Sample Output  Download

Tags




Discuss




14124 - EE2310_Lab9_2   

Description

#include <stdio.h>
#include <stdlib.h>


struct node{
    int data;
    struct node *next;
};
typedef struct node node_t;

typedef struct linked_list {
    node_t *head;
    node_t *tail;
} linked_list_t;

void initialize(linked_list_t *list_ptr) {
    list_ptr->head = NULL;
    list_ptr->tail = NULL;
}

void output(/* define your own arguments */) {
/*
 * Re-write this using recursion
 * DO NOT reuse your code in Lecture 8-2
 */
}

 

void add_node(linked_list_t *list_ptr, int data) {
/*
 * Use your code in Lecture 8-2
 */
}

 

void reverse_output(/* define your own arguments */) {
/*
 * Your code here
 */
}

int main(){
    linked_list_t my_list;
    initialize(&my_list);
    node_t *middle_ptr;
    
    int data, input_size;
    /* when you add a node, you add it at the tail */
    
    scanf("%d\n", &input_size);
    for(int i=0; i < input_size; ++i) {
        scanf("%d", &data);
        add_node(&my_list, data);
    }
    
    output(/* add your own arguments */);
    reverse_output(/* add your own arguments */);

    printf("\n");
    return 0;
}

 

Input

5
1 33 53 5 9

Output

1_33_53_5_9_
9_5_53_33_1_

Sample Input  Download

Sample Output  Download

Tags




Discuss




14125 - EE2310_Lab9_3   

Description

#include <stdio.h>


int fibonacci(int n) {
    /*
     * Your code here
     */
}


int main(void) {
  int n;
  scanf("%d", &n);
  printf("%d\n", fibonacci(n));
  return 0;
}

Input

11

Output

89

Sample Input  Download

Sample Output  Download

Tags




Discuss