From bb8bdefa2a12820f9c1e6f410c4556c288f7bab3 Mon Sep 17 00:00:00 2001 From: Zjasmine1024 Date: Sat, 13 Apr 2024 17:27:48 -0400 Subject: [PATCH 1/2] Update Quicksort.cpp --- C++/Sorting algo/Quicksort.cpp | 109 +++++++++++++-------------------- 1 file changed, 42 insertions(+), 67 deletions(-) diff --git a/C++/Sorting algo/Quicksort.cpp b/C++/Sorting algo/Quicksort.cpp index 0ef3cbe..f5c6726 100644 --- a/C++/Sorting algo/Quicksort.cpp +++ b/C++/Sorting algo/Quicksort.cpp @@ -1,67 +1,42 @@ -#include -#include -#include -#include -#include -#include -#include -using namespace std; - - - -int partition (int arr[], int low, int high) -{ - int pivot = arr[high]; // pivot - int i = (low - 1); // Index of smaller element - - for (int j = low; j <= high- 1; j++) - { - // If current element is smaller than or - // equal to pivot - if (arr[j] <= pivot) - { - i++; // increment index of smaller element - swap(arr[i], arr[j]); - } - } - swap(arr[i + 1], arr[high]); - return (i + 1); -} - - -void quickSort(int arr[], int low, int high) -{ - if (low < high) - { - /* pi is partitioning index, arr[p] is now - at right place */ - int pi = partition(arr, low, high); - - // Separately sort elements before - // partition and after partition - quickSort(arr, low, pi - 1); - quickSort(arr, pi + 1, high); - } -} - - -void printArray(int arr[], int size) -{ - int i; - for (i=0; i < size; i++) - cout< Date: Sat, 13 Apr 2024 17:39:33 -0400 Subject: [PATCH 2/2] updated version --- Python/DataFlair-Alarm-Clock.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Python/DataFlair-Alarm-Clock.py b/Python/DataFlair-Alarm-Clock.py index b26a083..ac93eb2 100644 --- a/Python/DataFlair-Alarm-Clock.py +++ b/Python/DataFlair-Alarm-Clock.py @@ -1,5 +1,6 @@ # *Welcome to DataFlair Alarm Clock* +# Jasmine's debug version #Importing all the necessary libraries to form the alarm clock: from tkinter import * @@ -12,12 +13,8 @@ def alarm(set_alarm_timer): while True: time.sleep(1) - current_time = datetime.datetime.now() - now = current_time.strftime("%H:%M:%S") - date = current_time.strftime("%d/%m/%Y") - print("The Set Date is:",date) - print(now) - if now == set_alarm_timer: + current_time = datetime.datetime.now().strftime("%H:%M:%S") + if current_time == set_alarm_timer: print("Time to Wake up") winsound.PlaySound("sound.wav",winsound.SND_ASYNC) break @@ -28,11 +25,10 @@ def actual_time(): clock = Tk() clock.title("DataFlair Alarm Clock") -clock.iconbitmap(r"dataflair-logo.ico") clock.geometry("400x200") -time_format=Label(clock, text= "Enter time in 24 hour format!", fg="red",bg="black",font="Arial").place(x=60,y=120) -addTime = Label(clock,text = "Hour Min Sec",font=60).place(x = 110) -setYourAlarm = Label(clock,text = "When to wake you up",fg="blue",relief = "solid",font=("Helevetica",7,"bold")).place(x=0, y=29) +Label(clock, text= "Enter time in 24 hour format!", fg="red",bg="black",font="Arial").place(x=60,y=120) +Label(clock,text = "Hour Min Sec",font=60).place(x = 110) +Label(clock,text = "When to wake you up",fg="blue",relief = "solid",font=("Helevetica",7,"bold")).place(x=0, y=29) # The Variables we require to set the alarm(initialization): hour = StringVar() @@ -45,7 +41,7 @@ def actual_time(): secTime = Entry(clock,textvariable = sec,bg = "pink",width = 15).place(x=200,y=30) #To take the time input by user: -submit = Button(clock,text = "Set Alarm",fg="red",width = 10,command = actual_time).place(x =110,y=70) +Button(clock,text = "Set Alarm",fg="red",width = 10,command = actual_time).place(x =110,y=70) clock.mainloop() #Execution of the window.