VOOZH about

URL: https://www.geeksforgeeks.org/dsa/test-case-generation-set-5-generating-random-sorted-arrays-palindromes/

⇱ Test Case Generation | Set 5 (Generating random Sorted Arrays and Palindromes) - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Test Case Generation | Set 5 (Generating random Sorted Arrays and Palindromes)

Last Updated : 2 Apr, 2024

Generating Random Sorted Arrays We store the random array elements in an array and then sort it and print it. 

Time complexity :  O(N log N)

Space complexity : O(N)

  Generating Random Palindromes

  • The test case generation plan generates odd as well as even length palindromes.
  • The test case generation plan uses one of the most under-rated data structure- Deque
  • Since a palindrome is read the same from left as well as right so we simply put the same random characters on both the left side (done using push_front()) and the right side (done using push_back())

Time complexity :  O(N)

Space complexity : O(N)

If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks. References : - http://spojtoolkit.com/TestCaseGenerator/ Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Comment
Article Tags:
Article Tags: