conversations listlengths 2 2 | source stringclasses 8
values |
|---|---|
[
{
"role": "user",
"content": "Implement `bubble_sort(a list arr)` to sort a list with bubble sort. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\... | algorithms |
[
{
"role": "user",
"content": "Produce a clean implementation of `bubble_sort`: sort a list with bubble sort. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n ... | algorithms |
[
{
"role": "user",
"content": "Implement the function `bubble_sort` (a list arr) -> a sorted list. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a =... | algorithms |
[
{
"role": "user",
"content": "I need a Python helper `bubble_sort` that sort a list with bubble sort. Use only the standard library."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n ... | algorithms |
[
{
"role": "user",
"content": "Formulate `bubble_sort` to sort a list with bubble sort. "
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list(arr)\n n = len(a)\n for i in ... | algorithms |
[
{
"role": "user",
"content": "Build a function `bubble_sort` that sort a list with bubble sort, with edge-case handling. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError... | algorithms |
[
{
"role": "user",
"content": "Draft a Python function `bubble_sort` to sort a list with bubble sort. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a lis... | algorithms |
[
{
"role": "user",
"content": "Provide a Python solution for `bubble_sort`: sort a list with bubble sort. Include basic type checks."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n ... | algorithms |
[
{
"role": "user",
"content": "Define a function `bubble_sort` taking a list arr and returning a sorted list. Use only the standard library."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\... | algorithms |
[
{
"role": "user",
"content": "Add a function `bubble_sort` that sort a list with bubble sort. "
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list(arr)\n n = len(a)\n fo... | algorithms |
[
{
"role": "user",
"content": "Add a function `bubble_sort` that sort a list with bubble sort. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list(arr... | algorithms |
[
{
"role": "user",
"content": "Generate a Python function `bubble_sort` for sort a list with bubble sort. "
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list(arr)\n n = len... | algorithms |
[
{
"role": "user",
"content": "Help me write `bubble_sort` that sort a list with bubble sort. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list... | algorithms |
[
{
"role": "user",
"content": "Develop `bubble_sort` such that it sort a list with bubble sort. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = ... | algorithms |
[
{
"role": "user",
"content": "Write `bubble_sort`: sort a list with bubble sort. "
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list(arr)\n n = len(a)\n for i in range(... | algorithms |
[
{
"role": "user",
"content": "Generate a Python function `bubble_sort` for sort a list with bubble sort. Keep it efficient."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list... | algorithms |
[
{
"role": "user",
"content": "Write `bubble_sort` handling edge cases; it should sort a list with bubble sort. Include basic type checks."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")... | algorithms |
[
{
"role": "user",
"content": "Implement `bubble_sort` with proper validation: sort a list with bubble sort. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must b... | algorithms |
[
{
"role": "user",
"content": "Please provide `bubble_sort` that sort a list with bubble sort. Add a brief docstring."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list(arr)\n... | algorithms |
[
{
"role": "user",
"content": "Create a utility function named `bubble_sort` which sort a list with bubble sort. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a li... | algorithms |
[
{
"role": "user",
"content": "Implement `bubble_sort(a list arr)` to sort a list with bubble sort. Keep it efficient."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list(arr)\... | algorithms |
[
{
"role": "user",
"content": "Produce a clean implementation of `bubble_sort`: sort a list with bubble sort. Keep it efficient."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = ... | algorithms |
[
{
"role": "user",
"content": "Create a utility function named `bubble_sort` which sort a list with bubble sort. Keep it efficient."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a... | algorithms |
[
{
"role": "user",
"content": "Create a utility function named `bubble_sort` which sort a list with bubble sort. Add a brief docstring."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n ... | algorithms |
[
{
"role": "user",
"content": "Produce a clean implementation of `bubble_sort`: sort a list with bubble sort. Use only the standard library."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\... | algorithms |
[
{
"role": "user",
"content": "Produce a clean implementation of `bubble_sort`: sort a list with bubble sort. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a lis... | algorithms |
[
{
"role": "user",
"content": "Implement `bubble_sort`. It should sort a list with bubble sort. Include basic type checks."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list(a... | algorithms |
[
{
"role": "user",
"content": "Code a function `bubble_sort` to sort a list with bubble sort. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = li... | algorithms |
[
{
"role": "user",
"content": "Write `bubble_sort` handling edge cases; it should sort a list with bubble sort. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a l... | algorithms |
[
{
"role": "user",
"content": "Implement the function `bubble_sort` (a list arr) -> a sorted list. Include basic type checks."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = lis... | algorithms |
[
{
"role": "user",
"content": "Write a Python function `bubble_sort` that sort a list with bubble sort. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a =... | algorithms |
[
{
"role": "user",
"content": "Formulate `bubble_sort` to sort a list with bubble sort. Add a brief docstring."
},
{
"role": "assistant",
"content": "def bubble_sort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n a = list(arr)\n n =... | algorithms |
[
{
"role": "user",
"content": "Produce a clean implementation of `quicksort`: sort a list with quicksort. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n... | algorithms |
[
{
"role": "user",
"content": "Make a function `quicksort` to sort a list with quicksort. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if l... | algorithms |
[
{
"role": "user",
"content": "Formulate `quicksort` to sort a list with quicksort. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <= 1:\... | algorithms |
[
{
"role": "user",
"content": "Help me write `quicksort` that sort a list with quicksort. Add a brief docstring."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <= 1:\n ... | algorithms |
[
{
"role": "user",
"content": "Please provide `quicksort` that sort a list with quicksort. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr)... | algorithms |
[
{
"role": "user",
"content": "I need a Python helper `quicksort` that sort a list with quicksort. Keep it efficient."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <= 1:... | algorithms |
[
{
"role": "user",
"content": "Code a function `quicksort` to sort a list with quicksort. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <= 1:\n... | algorithms |
[
{
"role": "user",
"content": "Can you write code for `quicksort` that sort a list with quicksort? Include basic type checks."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(ar... | algorithms |
[
{
"role": "user",
"content": "Draft a Python function `quicksort` to sort a list with quicksort. Use only the standard library."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len... | algorithms |
[
{
"role": "user",
"content": "Provide a Python solution for `quicksort`: sort a list with quicksort. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n ... | algorithms |
[
{
"role": "user",
"content": "Provide a Python solution for `quicksort`: sort a list with quicksort. Keep it efficient."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <=... | algorithms |
[
{
"role": "user",
"content": "Please provide `quicksort` that sort a list with quicksort. "
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <= 1:\n return list(arr)... | algorithms |
[
{
"role": "user",
"content": "Can you write code for `quicksort` that sort a list with quicksort? Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\... | algorithms |
[
{
"role": "user",
"content": "Write code for `quicksort` (a list arr) that sort a list with quicksort. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a lis... | algorithms |
[
{
"role": "user",
"content": "Write a Python function `quicksort` that sort a list with quicksort. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")... | algorithms |
[
{
"role": "user",
"content": "I need a Python helper `quicksort` that sort a list with quicksort. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\... | algorithms |
[
{
"role": "user",
"content": "Define a function `quicksort` taking a list arr and returning a sorted list. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n i... | algorithms |
[
{
"role": "user",
"content": "Implement `quicksort` with proper validation: sort a list with quicksort. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n ... | algorithms |
[
{
"role": "user",
"content": "Write `quicksort` handling edge cases; it should sort a list with quicksort. Add a brief docstring."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if l... | algorithms |
[
{
"role": "user",
"content": "Produce a clean implementation of `quicksort`: sort a list with quicksort. Use only the standard library."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n ... | algorithms |
[
{
"role": "user",
"content": "Implement the function `quicksort` (a list arr) -> a sorted list. Include basic type checks."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr)... | algorithms |
[
{
"role": "user",
"content": "Write `quicksort` in Python. It should sort a list with quicksort. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr)... | algorithms |
[
{
"role": "user",
"content": "Create a robust `quicksort` that sort a list with quicksort. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) ... | algorithms |
[
{
"role": "user",
"content": "Create a robust `quicksort` that sort a list with quicksort. "
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <= 1:\n return list(arr... | algorithms |
[
{
"role": "user",
"content": "Help me write `quicksort` that sort a list with quicksort. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <=... | algorithms |
[
{
"role": "user",
"content": "Code a function `quicksort` to sort a list with quicksort. Include basic type checks."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <= 1:\... | algorithms |
[
{
"role": "user",
"content": "Write a reusable function `quicksort` which sort a list with quicksort. Keep it efficient."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <... | algorithms |
[
{
"role": "user",
"content": "Write a Python function `quicksort` that sort a list with quicksort. Keep it efficient."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <= 1... | algorithms |
[
{
"role": "user",
"content": "Write `quicksort` in Python. It should sort a list with quicksort. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if l... | algorithms |
[
{
"role": "user",
"content": "Implement `quicksort(a list arr)` to sort a list with quicksort. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <... | algorithms |
[
{
"role": "user",
"content": "Build a function `quicksort` that sort a list with quicksort, with edge-case handling. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be... | algorithms |
[
{
"role": "user",
"content": "Please provide `quicksort` that sort a list with quicksort. Use only the standard library."
},
{
"role": "assistant",
"content": "def quicksort(arr: list) -> list:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n if len(arr) <... | algorithms |
[
{
"role": "user",
"content": "Implement `binary_search(a sorted list arr and target)` to binary search a sorted list. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\... | algorithms |
[
{
"role": "user",
"content": "Write `binary_search` handling edge cases; it should binary search a sorted list. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError... | algorithms |
[
{
"role": "user",
"content": "Develop `binary_search` such that it binary search a sorted list. Keep it efficient."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n lo, hi =... | algorithms |
[
{
"role": "user",
"content": "Create a robust `binary_search` that binary search a sorted list. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n l... | algorithms |
[
{
"role": "user",
"content": "Create `binary_search(a sorted list arr and target)` returning the index or -1. Include basic type checks."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a... | algorithms |
[
{
"role": "user",
"content": "Generate a Python function `binary_search` for binary search a sorted list. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list... | algorithms |
[
{
"role": "user",
"content": "Implement `binary_search` with proper validation: binary search a sorted list. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must b... | algorithms |
[
{
"role": "user",
"content": "Develop `binary_search` such that it binary search a sorted list. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n l... | algorithms |
[
{
"role": "user",
"content": "Add a function `binary_search` that binary search a sorted list. Include basic type checks."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n l... | algorithms |
[
{
"role": "user",
"content": "Create a robust `binary_search` that binary search a sorted list. Include basic type checks."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n ... | algorithms |
[
{
"role": "user",
"content": "I need a Python helper `binary_search` that binary search a sorted list. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr mu... | algorithms |
[
{
"role": "user",
"content": "Create `binary_search(a sorted list arr and target)` returning the index or -1. Add a brief docstring."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a lis... | algorithms |
[
{
"role": "user",
"content": "Create a utility function named `binary_search` which binary search a sorted list. "
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n lo, hi = ... | algorithms |
[
{
"role": "user",
"content": "Provide a Python solution for `binary_search`: binary search a sorted list. Add a brief docstring."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")... | algorithms |
[
{
"role": "user",
"content": "Implement `binary_search` returning the index or -1 given a sorted list arr and target. Add a brief docstring."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must ... | algorithms |
[
{
"role": "user",
"content": "Create a robust `binary_search` that binary search a sorted list. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n... | algorithms |
[
{
"role": "user",
"content": "Formulate `binary_search` to binary search a sorted list. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")... | algorithms |
[
{
"role": "user",
"content": "Develop `binary_search` such that it binary search a sorted list. "
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n lo, hi = 0, len(arr) - 1\n... | algorithms |
[
{
"role": "user",
"content": "Can you write code for `binary_search` that binary search a sorted list? "
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n lo, hi = 0, len(arr... | algorithms |
[
{
"role": "user",
"content": "Can you write code for `binary_search` that binary search a sorted list? Keep it efficient."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n l... | algorithms |
[
{
"role": "user",
"content": "Produce a clean implementation of `binary_search`: binary search a sorted list. Use only the standard library."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must ... | algorithms |
[
{
"role": "user",
"content": "Construct `binary_search` to binary search a sorted list. Include basic type checks."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n lo, hi =... | algorithms |
[
{
"role": "user",
"content": "I need a Python helper `binary_search` that binary search a sorted list. Include basic type checks."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\"... | algorithms |
[
{
"role": "user",
"content": "Create `binary_search(a sorted list arr and target)` returning the index or -1. Use only the standard library."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must ... | algorithms |
[
{
"role": "user",
"content": "Construct `binary_search` to binary search a sorted list. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")... | algorithms |
[
{
"role": "user",
"content": "Make a function `binary_search` to binary search a sorted list. Include basic type checks."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n lo... | algorithms |
[
{
"role": "user",
"content": "Implement `binary_search` with proper validation: binary search a sorted list. "
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n lo, hi = 0, l... | algorithms |
[
{
"role": "user",
"content": "Implement the function `binary_search` (a sorted list arr and target) -> the index or -1. Include basic type checks."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr... | algorithms |
[
{
"role": "user",
"content": "Write `binary_search`: binary search a sorted list. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n ... | algorithms |
[
{
"role": "user",
"content": "Create a utility function named `binary_search` which binary search a sorted list. Use only the standard library."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr mu... | algorithms |
[
{
"role": "user",
"content": "Create a utility function named `binary_search` which binary search a sorted list. Keep it efficient."
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list... | algorithms |
[
{
"role": "user",
"content": "Add a function `binary_search` that binary search a sorted list. "
},
{
"role": "assistant",
"content": "def binary_search(arr: list, target) -> int:\n if not isinstance(arr, list):\n raise TypeError(\"arr must be a list\")\n lo, hi = 0, len(arr) - 1\n ... | algorithms |
[
{
"role": "user",
"content": "Provide a Python solution for `bfs`: traverse a graph with BFS. Avoid mutating the input."
},
{
"role": "assistant",
"content": "from collections import deque\n\ndef bfs(graph: dict, start):\n if start not in graph:\n return []\n visited = set([start])\... | algorithms |
[
{
"role": "user",
"content": "Provide a Python solution for `bfs`: traverse a graph with BFS. Keep it efficient."
},
{
"role": "assistant",
"content": "from collections import deque\n\ndef bfs(graph: dict, start):\n if start not in graph:\n return []\n visited = set([start])\n qu... | algorithms |
[
{
"role": "user",
"content": "Build a function `bfs` that traverse a graph with BFS, with edge-case handling. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "from collections import deque\n\ndef bfs(graph: dict, start):\n if start not in graph:\n return []\n ... | algorithms |
[
{
"role": "user",
"content": "Write a Python function `bfs` that traverse a graph with BFS. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "from collections import deque\n\ndef bfs(graph: dict, start):\n if start not in graph:\n return []\n visited = set([start... | algorithms |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.