- Quantumly randomise the list. As there are n! possibilities, this will create n! branches of the universe.
- In each universe, check if the list is sorted. If not, destroy the universe.
- Surviving universe contains sorted list.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
from streamlit.delta_generator import DeltaGenerator | |
def display_centered_text(text: str, container: Optional[DeltaGenerator] = None): | |
if container is not None: | |
container.markdown( | |
f"<div style='text-align: center;'>{text}</div>", | |
unsafe_allow_html=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
def main(): | |
st.title("WikiUpdate") | |
st.write("Extractive Summarization Based Indonesian Paragraph Generator " + | |
"for Character Biography") | |
st.session_state["character_name"] = st.text_input( | |
label="Character's Name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<div> | |
{% if error is defined and error != '' %} | |
<div class="card center w-50 card-error"> | |
<h5 class="card-header">Error</h5> | |
<div class="card-body"> | |
{{error}} | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<div class="container"> | |
<form action="/submit" method="post"> | |
<table class="subContainer"> | |
<h4>Character's Name</h4> | |
<input class="form-control" type="text" id="input_name" name="input_name"> | |
</table> | |
<input class="center btn btn-primary" type="submit" value="Generate"> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import shuffle | |
from typing import List | |
def bogobogosort(items: List, reverse: bool = False) -> List: | |
""" Sorts a list... eventually | |
Args: | |
items (List): list of items to be sorted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import shuffle | |
from typing import List | |
def bogosort(items: List, reverse: bool = False) -> List: | |
""" Sorts a list by shuffling the elements | |
Args: | |
items (List): list of items to be sorted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
from threading import Timer | |
from typing import List | |
def sleepsort(items: List, reverse: bool = False) -> List: | |
""" Sorts a list by sleeping. | |
Credit: rosettacode.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
def intelligent_design_sort(items: List, reverse: bool = False) -> List: | |
""" Sorts a list based on Intelligent Design philosophy. | |
Probability of a list being in its current order is 1/(n!). It is a very | |
small probability that it is absurd to claim it happens by chance. | |
The only possible explanation is that the list has been put in that order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import sample | |
from typing import List | |
def thanos_sort(items: List, reverse: bool = False) -> List: | |
""" Sorts a list by snapping the list until it is sorted. | |
"Because you murdered half the planet!" | |
"A small price to pay for salvation." |
NewerOlder